From: | "Kaufhold, Christian (LFD)" <Christian(dot)Kaufhold(at)blfd(dot)bayern(dot)de> |
---|---|
To: | <pgsql-performance(at)postgresql(dot)org> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Query slow after analyse on postgresql 8.2 |
Date: | 2010-06-17 15:30:25 |
Message-ID: | 0694BCCA1B37BE4B8FEB01807799BD540142B481@BLFD_2.lfd.bayern.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Thanks Tom,
alter table boden.massnahmeobjekt alter column aktennummer set statistics 1000;
fixed it.
Regards
Christian
-----Ursprüngliche Nachricht-----
Von: pgsql-performance-owner(at)postgresql(dot)org [mailto:pgsql-performance-owner(at)postgresql(dot)org] Im Auftrag von Tom Lane
Gesendet: Donnerstag, 17. Juni 2010 16:59
An: Kaufhold, Christian (LFD)
Cc: pgsql-performance(at)postgresql(dot)org
Betreff: Re: [PERFORM] Query slow after analyse on postgresql 8.2
"Kaufhold, Christian (LFD)" <Christian(dot)Kaufhold(at)blfd(dot)bayern(dot)de> writes:
> I have the following query that I run agains postgresql 8.2:
> ...
> But when I run analyse the same query runs for hours.
Seems like the core of the problem is here:
> -> Seq
> Scan on massnahmeobjekt m (cost=0.00..3271.88 rows=1 width=94)
> (actual
> time=0.387..577.771 rows=3694 loops=1)
> Filter: ((aktennummer)::text ~* 'M\\-2009\\-1'::text)
If that rowcount estimate weren't off by three orders of magnitude you probably would be getting a more appropriate plan. The first thing you could try is increasing the statistics target for aktennummer. Also, if you're running in a non-C locale and this is 8.2.5 or older, try a more recent 8.2.x. Updating to 8.3 or 8.4 might help even more.
regards, tom lane
--
Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
From | Date | Subject | |
---|---|---|---|
Next Message | Jatinder Sangha | 2010-06-17 16:57:15 | HashAggregate slower than sort? |
Previous Message | Tom Lane | 2010-06-17 14:58:36 | Re: Query slow after analyse on postgresql 8.2 |