Re: [GENERAL] how to import "where exists(subquery)" EXISTS CONDITION performance?

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [GENERAL] how to import "where exists(subquery)" EXISTS CONDITION performance?
Дата
Msg-id CAKJS1f-85jiy8HOZDnJpgF_ncHCSuhS_zbkmCOLUchr39hjTRg@mail.gmail.com
обсуждение исходный текст
Ответ на how to import "where exists(subquery)" EXISTS CONDITION performance?  (shili <shi_li_1992@163.com>)
Список pgsql-general
On 2 December 2015 at 20:51, shili <shi_li_1992@163.com> 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?

That sounds like it might be quite out-dated information. Semi joins have been supported for around 7 years. 


However, there are cases where this is still not possible, for example if the subquery contains a volatile function, or perhaps a LIMIT or OFFSET.

You can view the output from the planner by prefixing your SELECT statement with EXPLAIN: See http://www.postgresql.org/docs/current/static/sql-explain.html
This will give you the information you need to see how the query planner has decided on how your query will be executed.

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

В списке pgsql-general по дате отправления:

Предыдущее
От: shili
Дата:
Сообщение: how to import "where exists(subquery)" EXISTS CONDITION performance?
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: plperlu stored procedure seems to freeze for a minute