Re:

From: Haller Christoph <ch(at)rodos(dot)fzk(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re:
Date: 2001-09-07 15:13:38
Message-ID: 200109071313.PAA12669@rodos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

My understanding is you did it the best way.
Alternatively, you may word your query as
SELECT i.cname FROM fc_client_info i
WHERE EXISTS ( SELECT * FROM fc_communication c
WHERE c.acode = i.acode
AND c.contactdate = '09/06/2001' )
ORDER BY lower(i.cname);
instead of
SELECT i.cname FROM fc_client_info i, fc_communication c WHERE i.acode =
c.acode AND c.contactdate = '09/06/2001' ORDER BY lower(cname);

I suppose the correlated subquery using the EXISTS predicate, which
results in an outer loop join, is much slower than your originally
used sort-merge join.
Try, but make sure both tables are well populated, otherwise the
benchmark result is no good.
Christoph

Browse pgsql-sql by date

  From Date Subject
Next Message Haller Christoph 2001-09-07 15:38:00 ERROR: DefineQueryRewrite: rule plan string too big.
Previous Message Tom Lane 2001-09-07 14:19:38 Re: ERROR: DefineQueryRewrite: rule plan string too big.