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

Re: slow queries after ANALYZE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dwinner-lists(at)att(dot)net
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: slow queries after ANALYZE
Date: 2005-11-11 19:32:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
DW <dwinner-lists(at)att(dot)net> writes:
> I'm perplexed. I'm trying to find out why some queries are taking a long 
> time, and have found that after running analyze,  one particular query 
> becomes slow.

This implies that the planner's default choice of plan (without any
statistics) is better than its choice when informed by statistics.
This is undesirable but not unheard of :-(

It would be interesting to see EXPLAIN ANALYZE results in both cases,
plus the contents of the relevant pg_stats rows.  (BTW, you need not
dump and reload to get back to the virgin state --- just delete the
relevant rows from pg_statistic.)  Also we'd want to know exactly what
PG version this is, and on what sort of platform.

You might be able to fix things by increasing the statistics targets or
tweaking planner cost parameters, but it'd be best to investigate before
trying to fix.

			regards, tom lane

In response to


pgsql-performance by date

Next:From: DWDate: 2005-11-11 20:48:16
Subject: Re: slow queries after ANALYZE
Previous:From: DWDate: 2005-11-11 19:16:01
Subject: slow queries after ANALYZE

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