Heikki Linnakangas escribió:

> Oprofile suggests that most of the time is actually spent in  
> pgstat_vacuum_stat. And more precisely in pstat_collect_oids, which is  
> called by pgstat_vacuum_stat.

Hmm, that routine is expensive.  Calling it for every vacuum is not good
:-(  Fortunately, autovacuum calls it only once per worker run rather
than once per table.  That limits the damage.

I wonder if we could do better in pgstat_vacuum_stat; for example,
scanning all of pg_proc is useless most of the time, and then it has to
fill and seq-search a hash table with all the builtins which will never
get dropped.  I wonder if we could use pg_depend instead of pg_proc, and
skip pinned functions, for example.

In the end, it would be better if this function was not called at all
for user-invoked vacuum, and have autovacuum handle it.  However, that
doesn't work for people who disable autovacuum.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to