Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions
Дата
Msg-id 1405979651518-5812289.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions  (johno <jan.suchal@gmail.com>)
Ответы Re: Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions
Список pgsql-performance
johno wrote
> Thanks for the quick reply David!
>
> However I am still unsure how these two queries are not relationally
> equivalent. I am struggling to find a counterexample where the first and
> third query (in email, not in gist) would yield different results. Any
> ideas?

Remove the outer LIMIT 100 from both queries...

The first query would return a maximal number of rows that meet the OR
criteria while the second query would return at most 200 rows since both
sub-queries would still have their own independent LIMIT 100 clauses.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Slow-query-with-indexed-ORDER-BY-and-LIMIT-when-using-OR-d-conditions-tp5812282p5812289.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


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

Предыдущее
От: johno
Дата:
Сообщение: Re: Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions
Следующее
От: johno
Дата:
Сообщение: Re: Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions