From: Josh Berkus <josh@agliodbs.com>
To: David Jaquay <djaquay@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query across a date range
Date: Fri, 7 Jan 2005 12:15:27 -0800
Message-ID: <200501071215.27782.josh@agliodbs.com> (raw)
In-Reply-To: <ad4aa5a805010712047409fce9@mail.gmail.com>
References: <20050107182106.6CBEC5AF685@svr4.postgresql.org>
<200501071135.11229.josh@agliodbs.com>
<ad4aa5a805010712047409fce9@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, djaquay@gmail.com
Subject: Re: Query across a date range
In-Reply-To: <200501071215.27782.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox