From: | Ennio-Sr <nasr(dot)laili(at)tin(dot)it> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | Ennio-Sr <nasr(dot)laili(at)tin(dot)it>, Richard Huxton <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Display of text fields |
Date: | 2004-09-10 17:55:01 |
Message-ID: | 20040910175501.GA9535@deby.ei.hnet |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
* Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> [100904, 10:39]:
> On Fri, 10 Sep 2004, Ennio-Sr wrote:
> > > > * Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)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) ]
From | Date | Subject | |
---|---|---|---|
Next Message | Nick | 2004-09-10 18:33:08 | What is the postgres version of mysql's "ON DUPLICATE KEY" |
Previous Message | Stephan Szabo | 2004-09-10 17:39:07 | Re: Display of text fields |