Skip site navigation (1) Skip section navigation (2)

Re: Optimizer Selecting Incorrect Index

From: "David Price" <dprice(at)dentfirst(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"Richard Huxton" <dev(at)archonet(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Optimizer Selecting Incorrect Index
Date: 2004-08-26 11:05:26
Message-ID: OJEEJPPOBPODJFPEOFAGMECACGAA.dprice@dentfirst.com (view raw or flat)
Thread:
Lists: pgsql-performance
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(at)postgresql(dot)org
[mailto:pgsql-performance-owner(at)postgresql(dot)org]On Behalf Of Tom Lane
Sent: Wednesday, August 25, 2004 3:08 PM
To: Richard Huxton
Cc: David Price; pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Optimizer Selecting Incorrect Index


Richard Huxton <dev(at)archonet(dot)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(at)postgresql(dot)org so that your
      message can get through to the mailing list cleanly



In response to

pgsql-performance by date

Next:From: Andrew RawnsleyDate: 2004-08-26 12:07:42
Subject: Re: Anyone familiar with Apple Xserve RAID
Previous:From: Richard HuxtonDate: 2004-08-26 10:17:34
Subject: Re: Optimizer Selecting Incorrect Index

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group