Re: Function to total reset a schema

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Surfing <onlinesurfing(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Function to total reset a schema
Date: 2011-05-29 07:49:53
Message-ID: BANLkTinCSruCqUFNQkutKt_E8rZDYe=NKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, May 29, 2011 at 1:38 AM, Surfing <onlinesurfing(at)gmail(dot)com> wrote:
> Hi all,
> I need to write a function that totally empty a schema.
>
> So I have written a TRUNCATE statement for each table and set to 0 each
> sequence.
> Btw, it could be good to execute a vacuum statement on each table, but from
> within the function this is not allowed.

You shouldn't need to vacuum truncated tables, as they're basically at
a lower level just wiped out and replaced by a new empty file / table.
Same goes for the indexes I believe.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2011-05-29 07:54:41 Re: Function to total reset a schema
Previous Message Surfing 2011-05-29 07:38:04 Function to total reset a schema