Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: Database size Vs performance degradation


  • From: Craig James <craig_james(at)emolecules(dot)com>
  • To: Dave North <DNorth(at)signiant(dot)com>, pgsql-performance(at)postgresql(dot)org
  • Subject: Re: Database size Vs performance degradation
  • Date: Wed, 30 Jul 2008 08:32:24 -0700
  • Message-id: <48908988.7020204@emolecules.com> <text/plain>

Dave North wrote:
Thank you for the suggestion..much appreciated.  Alas, I don't think
this will be possible without a change to the application but it's a
good idea nonetheless.

I assume you mean the "create table as select ..." suggestion (don't forget to include a little quoted material so we'll know what you are replying to :-)

You don't have to change the application.  One of the great advantages of Postgres is that even table creation, dropping and renaming are transactional.  So you can do the select / drop / rename as a transaction by an external app, and your main application will be none the wiser.  In pseudo-SQL:

 begin
 create table new_table as (select * from old_table);
 create index ... on new_table ... (as needed)
 drop table old_table
 alter table new_table rename to old_table
 commit

You should be able to just execute this by hand on a running system, and see if some of your bloat goes away.

Craig



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group