pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stef <svb@ucs.co.za>
Cc: pgsql-performance@postgresql.org
Subject: Re: Analyze makes queries slow...
Date: Mon, 11 Aug 2003 11:43:45 -0400
Message-ID: <2934.1060616625@sss.pgh.pa.us> (raw)
In-Reply-To: <20030811155841.483ffd93.svb@ucs.co.za>
References: <20030811155841.483ffd93.svb@ucs.co.za>

Stef <svb@ucs.co.za> writes:
> I have attached an sql statement that normally runs under 3 minutes.
> That is, until I vacuum analyze the database (or just the tables in the query),
> then the same query runs longer than 12 hours, and I have to kill it.

Could we see the results of "EXPLAIN ANALYZE", rather than just EXPLAIN,
for the un-analyzed case?  I won't make you do it for the analyzed case ;-)
but when dealing with a plan-selection problem the planner's estimates
are obviously not to be trusted.

Also, what do you see in pg_stats (after analyzing) for each of the
tables used in the query?

And what PG version is this, exactly?

			regards, tom lane

PS: in case you don't know this already, an easy way to get back to the
un-analyzed state is "DELETE FROM pg_statistics".



view thread (7+ messages)  latest in thread

Message-ID: <2934.1060616625@sss.pgh.pa.us>
Permalink:  ../2934.1060616625@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2934.1060616625@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, svb@ucs.co.za
  Subject: Re: Analyze makes queries slow...
  In-Reply-To: <2934.1060616625@sss.pgh.pa.us>
  References: <20030811155841.483ffd93.svb@ucs.co.za> <2934.1060616625@sss.pgh.pa.us>

* 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