Re: Database size Vs performance degradation - Mailing list pgsql-performance

From Craig James
Subject Re: Database size Vs performance degradation
Date
Msg-id 48908988.7020204@emolecules.com
Whole thread Raw
In response to Re: Database size Vs performance degradation  ("Dave North" <DNorth@signiant.com>)
Responses Re: Database size Vs performance degradation  (Matthew Wakeling <matthew@flymine.org>)
List pgsql-performance
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'llknow 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,
droppingand renaming are transactional.  So you can do the select / drop / rename as a transaction by an external app,
andyour 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

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Database size Vs performance degradation
Next
From: Mark Roberts
Date:
Subject: Re: Database size Vs performance degradation