Re: Column correlation drifts, index ignored again - Mailing list pgsql-performance

From Josh Berkus
Subject Re: Column correlation drifts, index ignored again
Date
Msg-id 200402240859.32312.josh@agliodbs.com
Whole thread Raw
In response to Re: Column correlation drifts, index ignored again  (Kevin Brown <kevin@sysexperts.com>)
Responses Re: Column correlation drifts, index ignored again
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Nick Barr
Date:
Subject: Re: Slow join using network address function
Next
From: Richard Huxton
Date:
Subject: Re: [SQL] Materialized View Summary