Re: Analyze makes queries slow... - Mailing list pgsql-performance

From Tom Lane
Subject Re: Analyze makes queries slow...
Date
Msg-id 2934.1060616625@sss.pgh.pa.us
Whole thread Raw
In response to Analyze makes queries slow...  (Stef <svb@ucs.co.za>)
Responses Re: Analyze makes queries slow...
List pgsql-performance
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".

pgsql-performance by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Perfomance Tuning
Next
From: Stef
Date:
Subject: Re: Analyze makes queries slow...