Re: Query across a date range

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: David Jaquay <djaquay(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query across a date range
Date: 2005-01-07 20:15:27
Message-ID: 200501071215.27782.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message amrit 2005-01-08 00:29:18 Does "HYPERTHREADING" do any harm if we use with RH9.0 and postgresql?
Previous Message David Jaquay 2005-01-07 20:04:28 Re: Query across a date range