Re: Query across a date range

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Query across a date range
Дата
Msg-id 200501071215.27782.josh@agliodbs.com
обсуждение исходный текст
Ответ на Re: Query across a date range  (David Jaquay <djaquay@gmail.com>)
Список pgsql-performance
Dave,

Ah ....

>          ->  Seq Scan on sales_tickets s  (cost=0.00..89543.50
> rows=626783 width=12) (actual time=38.017..19387.447 rows=713846
> loops=1)

This is just more than 1/2 the time of your query.   The issue is that you're
pulling 713,000 rows (PG estimates 626,000 which is in the right ballpark)
and PG thinks that this is enough rows where a seq scan is faster.  It could
be right.

You can test that, force an indexscan by doing:
SET enable_seqscan = FALSE;

Also, please remember to run each query 3 times and report the time of the
*last* run to us.   We don't want differences in caching to throw off your
evaulation.

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

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

Предыдущее
От: David Jaquay
Дата:
Сообщение: Re: Query across a date range
Следующее
От: amrit@health2.moph.go.th
Дата:
Сообщение: Does "HYPERTHREADING" do any harm if we use with RH9.0 and postgresql?