Re: limit + order by is slow if no rows in result set

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: limit + order by is slow if no rows in result set
Дата
Msg-id 45D0F78C.40000@enterprisedb.com
обсуждение исходный текст
Ответ на limit + order by is slow if no rows in result set  (Brian Cox <brian.cox@ca.com>)
Список pgsql-performance
Brian Cox wrote:
>
> There are 1.9M rows in ts_defects and indexes on b.ts_id (primary key)
> d.ts_biz_event_id and d.ts_occur_date.  Both queries below return 0
> rows.  The 1st runs fast and the 2nd > 400x slower.  The 2nd query
> differs from the 1st only by the addition of "limit 1".
>
> Why the big difference in performance?

Please run EXPLAIN ANALYZE on both queries, and send back the results.
Also, what indexes are there on the tables involved?

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: Brian Cox
Дата:
Сообщение: limit + order by is slow if no rows in result set
Следующее
От: Brian Cox
Дата:
Сообщение: Re: limit + order by is slow if no rows in result set