Re: simple query runs 26 seconds

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrus" <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: simple query runs 26 seconds
Date: 2007-08-27 22:34:02
Message-ID: 9693.1188254042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Andrus" <kobruleht2(at)hot(dot)ee> writes:
>> The time seems entirely spent in fetching rows from table "rid".
>> Perhaps that table is bloated by lack of vacuuming --- can you
>> show the output from "vacuum verbose rid"?

OK, so the info relevant to this query is

> INFO: index "rid_toode_idx" now contains 1517900 row versions in 9950 pages
> DETAIL: 7375 index row versions were removed.
> 245 index pages have been deleted, 232 are currently reusable.

> INFO: "rid": found 7375 removable, 1517900 nonremovable row versions in
> 82560 pages
> DETAIL: 0 dead row versions cannot be removed yet.
> There were 292585 unused item pointers.
> 18375 pages contain useful free space.
> 0 pages are entirely empty.

which gives us a density of about 150 entries/page in the index and
18 rows/page in the heap proper. That seems a bit low --- do you think
your rows are several hundred bytes each? If not, the best cleanup
strategy is probably to CLUSTER the table on whichever index you use
most (dunno if this is your most important query or not).

> postgresql.conf contains
> autovacuum = on # enable autovacuum subprocess?
> However, log files does not show any autovacuum messages.
> So I expect that autovacuum in not running.
> Any idea why autovacuum is not running ?

Did you also turn on stats_row_level and stats_start_collector?

It could also be that autovac *is* running but its efforts are wasted
because of too small FSM settings --- what have you got max_fsm_pages
set to?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mrodriguez 2007-08-27 22:35:39 how to print a schema
Previous Message Matthew 2007-08-27 22:29:02 String Escaping in Pattern Matching