Re: Analyze makes queries slow...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stef <svb(at)ucs(dot)co(dot)za>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Analyze makes queries slow...
Date: 2003-08-11 15:43:45
Message-ID: 2934.1060616625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Stef <svb(at)ucs(dot)co(dot)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".

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-08-11 15:54:39 Re: Windows on SuSE? 7.4
Previous Message Andrew Sullivan 2003-08-11 15:24:14 Re: Perfomance Tuning