Re: Feature request: Truncate table

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Larry Rosenman" <ler(at)lerctr(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature request: Truncate table
Date: 2002-06-12 19:44:57
Message-ID: D90A5A6C612A39408103E6ECDD77B82920CF52@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Larry Rosenman [mailto:ler(at)lerctr(dot)org]
> Sent: Wednesday, June 12, 2002 12:36 PM
> To: Dann Corbit
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Feature request: Truncate table
>
>
> On Wed, 2002-06-12 at 14:32, Dann Corbit wrote:
> > Deletion of data from a PostgreSQL table is very slow.
> >
> > It would be nice to have a very fast delete like "truncate table."
> >
> > Now, truncate is a very dangerous command because it is not
> logged (but
> > the same is true for other operations like bulk copy and
> select into).
> > So one needs to be careful how this command is granted.
> The same damage
> > (accidental deletion of all data) can be done by drop table just as
> > easily.
> >
> > I frequently have to do this right now in PostgreSQL, but I simply
> > emulate it by drop table/create table.
> It's there:
> $ psql
> Welcome to psql, the PostgreSQL interactive terminal.
>
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help on internal slash commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> ler=# select version();
> version
> ---------------------------------------------------------------------
> PostgreSQL 7.2.1 on i386-portbld-freebsd4.6, compiled by GCC 2.95.3
> (1 row)
>
> ler=# \h truncate
> Command: TRUNCATE
> Description: empty a table
> Syntax:
> TRUNCATE [ TABLE ] name
>
> ler=#

Well bust my buttons! Now that's service!
;-)

I am busily doing a Win32 port of PostgreSQL 7.2.1 right now, so that is
wonderful news.

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2002-06-12 20:04:36 Re: Integrating libpqxx
Previous Message Larry Rosenman 2002-06-12 19:44:56 Re: Feature request: Truncate table