From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "shili *EXTERN*" <shi_li_1992(at)163(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: [GENERAL] how to import "where exists(subquery)" EXISTS CONDITION performance? |
Date: | 2015-12-03 09:32:42 |
Message-ID: | A737B7A37273E048B164557ADEF4A58B50FEF519@ntex2010i.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
shili wrote:
> I had saw this sentence: SQL statements that use the EXISTS condition in PostgreSQL are very inefficient
> since the sub-query is RE-RUN for EVERY row in the outer query's table. There are more efficient ways
> to write most queries, that do not use the EXISTS condition.
> So,I want to know how PostgreSQL to implement the EXISTS condition? Is that sentence true?
> and,if that is true,are there any methods to import the performance of the EXISTS condition?
You mean "improve", not "import", right?
If you try it out you will find that PostgreSQL often executes an EXISTS clause as a join,
so no, SQL statements using EXISTS are not necessarily slow.
Still it is often a good idea to use an explicit join instead of EXISTS if possible.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2015-12-03 09:42:27 | Re: how to import "where exists(subquery)" EXISTS CONDITION performance? |
Previous Message | Kaushal Shriyan | 2015-12-03 06:12:13 | Comparing two postgres dump files. |