Re: Query slow after analyse on postgresql 8.2

От: Tom Lane
Тема: Re: Query slow after analyse on postgresql 8.2
Дата: ,
(см: обсуждение, исходный текст)
Ответ на: Query slow after analyse on postgresql 8.2  ("Kaufhold, Christian (LFD)")
Список: pgsql-performance

"Kaufhold, Christian (LFD)" <> 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

В списке pgsql-performance по дате сообщения:

От: "Pierre C"
Сообщение: Re: PostgreSQL as a local in-memory cache
От: Greg Smith
Сообщение: Re: requested shared memory size overflows size_t