Kevin,
> 1. set enable_seqscan = on
> 2. set random_page_cost = <some really high value to force seqscans>
> 3. EXPLAIN ANALYZE query
> 4. record the ratio of estimated to actual scan times.
> 5. set enable_seqscan = off
> 6. set random_page_cost = <rough estimate of what it should be>
> 7. EXPLAIN ANALYZE query
> 8. record the actual index scan time(s)
> 9. tweak random_page_cost
> 10. EXPLAIN query
> 11. If ratio of estimate to actual (recorded in step 8) is much
> different than that recorded in step 4, then go back to step 9.
> Reduce random_page_cost if the random ratio is larger than the
> sequential ratio, increase if it's smaller.
Nice, we ought to post that somewhere people can find it in the future.
I'm also glad that your new job allows you to continue doing PostgreSQL stuff.
--
Josh Berkus
Aglio Database Solutions
San Francisco