At 09:18 AM 21/11/2002 +0100, Roel Rozendaal - IC&S wrote:
There hasn't been any ANALYZE statements at all (we migrated this db from another one and encountered the problem afterwards); but quite frankly i would still regard it as a bug if i need to run an ANALYZE statement first for such a simple query ;-)
Sometimes I must admit I find the optimizer/planner quite temperamental. But usually if you work within it's rules/limitations, it does a pretty reasonable job. I have sent details of the odd behaviour to the PG mailing lists, and will let you know what response I get (they are usually very responsive).
In the mean time, I can guess that one of the suggestions will be to do an ANALYZE. This is a cheap command that does not lock anything, so it is worth doing. Especially if, as seems to be the case, you have a test machine.
The other thing you need to do, if you are not doing it already, is a regular vacuum of the entire database, and probably a *very* regular vacuum of frequently UPDATED tables (eg. we vacuum the 'users' table every 5 minutes).
---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 03 5330 3172 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/