Re: Display of text fields - Mailing list pgsql-general

From Ennio-Sr
Subject Re: Display of text fields
Date
Msg-id 20040910175501.GA9535@deby.ei.hnet
Whole thread Raw
In response to Re: Display of text fields  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
* Stephan Szabo <sszabo@megazone.bigpanda.com> [100904, 10:39]:
> On Fri, 10 Sep 2004, Ennio-Sr wrote:
> > > > * Stephan Szabo <sszabo@megazone.bigpanda.com> [100904, 07:10]:
> > > > > On Fri, 10 Sep 2004, Ennio-Sr wrote:
> > > > > [ big cut ]
> > >
>
> Well, I'd expect that for large tables the outer join type solution would
> tend to be faster than joining every row to every other row and then using
> a unique step (probably after a sort) to basically remove the ones you
> don't want. If you try different solutions, you can use EXPLAIN ANALYZE to
> compare query plans.

Please forget my previous message: I've just finished trying your
'COALESCE' solution (prior to studying it ;) ) and it seems to work
greatly!

---------
SELECT
t0.a, t0.b, t0.c, COALESCE(t1.d, ' ') as note from foo t0 left OUTER
JOIN foo_d t1 on (t0.has_d = 'Y' AND t0.a=t1.a);

# the result is:

 a |  b   |   c    |               note
---+------+--------+----------------------------------
 1 | one  | number | is the first natural
 2 | two  | number | follows 1 in the seq of natural
 3 | tree | name   | there are various qualities of -
 4 | blue | color  |
 5 | john | person |
(5 rows)
^^^
---------
Perfect, I would say :-)
Thank you again so much indeed, Stephan.
    Ennio.

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.     \\?//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]     (°|°)
[Why to use Win$ozz (I say) if ... "even a fool can do that.             )=(
 Do something you aren't good at!" (used to say Henry Miller) ]

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Display of text fields
Next
From: "Chris Ochs"
Date:
Subject: SMgrRelation hashtable corrupted