Thursday, January 5, 2012

Postgresql - Maintenaince. Cleaning up the pg_attribute table

What is the pg_attribute table? http://www.postgresql.org/docs/9.1/static/catalog-pg-attribute.html
The catalog pg_attribute stores information about table columns. There will be exactly one pg_attribute row for every column in every table in the database. (There will also be attribute entries for indexes, and indeed all objects that have pg_class entries.) The term attribute is equivalent to column and is used for historical reasons.
Sometimes it could become "bloated", that is, it will have unnecessary information (due to invalid database objects) and some cleaning up would be in order for performance reasons. I found this reference about the issue: http://www.chasingnuts.com/2010/cleaning_pg_attribute_bloat/comment-page-1/#comment-54458 As simple as this
VACUUM FULL  pg_catalog.pg_class;
REINDEX TABLE pg_catalog.pg_class;
Damn, life would be so fucking beautiful if we all shared what we know.

No comments:

Post a Comment