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