Tom, your suspicions were correct - ANALYZE was not being run.
I run vacuumdb via a cron script during off hours. After checking the
scripts on both systems, I found that on the system that was not functioning
correctly that the '-z' (analyze) command line option to vacuumdb was
missing. After correcting it and re-running the script, the poorly
performing SQL query takes only a few seconds as opposed to 15 minutes.
Thank you for your help!
- David
-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Tom Lane
Sent: Wednesday, August 25, 2004 3:08 PM
To: Richard Huxton
Cc: David Price; pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Optimizer Selecting Incorrect Index
Richard Huxton <dev@archonet.com> writes:
> Things to check:
> 1. postgresql.conf settings match - different costs could cause this
> 2. statistics on the two columns (trn_patno,trn_old_date) - if they
> differ considerably between systems that would also explain it.
The different estimated row counts could only come from #2. I suspect
David has forgotten to run ANALYZE on the second system.
I agree that EXPLAIN VERBOSE output is not helpful...
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly