From: | Guillaume Smet <guillaume_ml(at)smet(dot)org> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Bad plan after vacuum analyze |
Date: | 2005-05-11 17:23:32 |
Message-ID: | 42823F94.8050009@smet.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi,
We have some performances problem on a particular query.
We reproduced the problem on a 7.4.5 and on a 7.4.7 server.
* we load the dump in a new database
* query: it's fast (< 1ms)
* VACUUM FULL ANALYZE;
* query: it's really slow (130ms) and it's another plan
* set enable_seqscan=off;
* query: it's fast (< 1ms) : it uses the best plan
I attached the EXPLAIN ANALYZE outputs, the query and the tables
description. I really can't understand why the planner chooses this plan
and especially the line :
-> Index Scan using acs_objects_object_id_p_hhkb1 on acs_objects t98
(cost=0.00..2554.07 rows=33510 width=81) (actual time=0.043..56.392
rows=33510 loops=1).
I never saw an index scan on such a number of lines. For your
information, there are 33510 lines in this table so it scans the whole
table.
The problem seems to be the left join on the acs_objects t98 table for
the parent_application_id as if I remove it or if I change it to a
subquery, it's ok. The query is automatically generated by a persistence
layer so I can't really rewrite it.
Thanks for any help
Regards
--
Guillaume
Attachment | Content-Type | Size |
---|---|---|
plan_after_vacuum.txt | text/plain | 2.9 KB |
plan_after_vacuum_seqscan_off.txt | text/plain | 2.6 KB |
plan_before_vacuum.txt | text/plain | 2.4 KB |
query_section.sql | text/x-sql | 2.5 KB |
tables.txt | text/plain | 5.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2005-05-11 18:10:15 | Re: Bad plan after vacuum analyze |
Previous Message | Josh Berkus | 2005-05-11 17:13:51 | Re: Partitioning / Clustering |