Forum OpenACS Development: Re: Tuning selects with tree_sortkey

Posted by Don Baccus on
PG normally uses the available index for BETWEEN expression, so I'm more interested in why it isn't in this case than I am in evaluating the rewritten query.

When was the last time you folks did an ANALYZE on the database? You should be doing it via a scheduled proc nightly, if you're not.

Sometimes PG guesses wrong and fails to use an index when it should.

But often it's because the statistics aren't up to date and it doesn't "know" that the tables have grown large.