pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Price <dprice@dentfirst.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimizer Selecting Incorrect Index
Date: Thu, 26 Aug 2004 07:05:26 -0400
Message-ID: <OJEEJPPOBPODJFPEOFAGMECACGAA.dprice@dentfirst.com> (raw)
In-Reply-To: <2137.1093460881@sss.pgh.pa.us>

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





view thread (6+ messages)

Message-ID: <OJEEJPPOBPODJFPEOFAGMECACGAA.dprice@dentfirst.com>
Permalink:  ../OJEEJPPOBPODJFPEOFAGMECACGAA.dprice@dentfirst.com/
Also on:    postgresql.org/message-id/OJEEJPPOBPODJFPEOFAGMECACGAA.dprice@dentfirst.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dprice@dentfirst.com, tgl@sss.pgh.pa.us, dev@archonet.com
  Subject: Re: Optimizer Selecting Incorrect Index
  In-Reply-To: <OJEEJPPOBPODJFPEOFAGMECACGAA.dprice@dentfirst.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox