Stats not updated after rollback -- autovacuum confused.

From: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Stats not updated after rollback -- autovacuum confused.
Date: 2007-05-07 05:50:07
Message-ID: 758d5e7f0705062250w7a39e5c6i438d2567216382a7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, I have a system where there are mostly COPYs,
which insert data into a table. Ocasionally a COPY will fail (and thus,
dead rows appear), but as far as I can tell ROLLBACK is not reflected
anywhere in the pg_stats_user_tables. And since there are no rows
n_tup_upd or n_tup_del, therefore autovacuum will not fire for that table.

I see two possible solutions:
1) let rollback increment both n_tup_ins and n_tup_del (or maybe
n_tup_upd, at least)? This would be a good safeguard, I guess.

2) ANALYZE is able to see wether table is accumulating dead rows.
It might be a good idea to make ANALYZE able hint autovacuum that
some tables need VACUUM (that they exceed limits set for autovacuum).

The 2nd point could be a TODO item, perhaps? Something like:
When ANALYZE runs, make it note removable dead rows and non-removable
dead rows. If removable dead rows exceed some threshold, hint autovacuum
at that table.

Regards,
Dawid

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2007-05-07 06:28:40 Re: Integer datetimes
Previous Message Pavel Stehule 2007-05-07 05:38:36 Re: plperl vs. bytea