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

Re: truncate vs. delete

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: truncate vs. delete
Date: 2008-07-24 14:01:46
Message-ID: 48888B4A.1090301@encs.concordia.ca (view raw or flat)
Thread:
Lists: pgsql-sql
A. Kretschmer wrote:
> am  Thu, dem 24.07.2008, um  9:47:48 -0400 mailte Emi Lu folgendes:
>> I found a link for SQL Server, it applies to PostgreSQL 8.0.x as well?
>> http://vadivel.blogspot.com/2004/06/delete-vs-truncate-statement.html
> 
> Not realy, for instance, pg can rollback a truncate, and a sequence are
> not reset.
> 
> 
Thank you. I am quite sure that I will not use "delete" now.
Now I a question about how efficient between

(1) truncate a big table (with 200, 000)
     vacuum it (optional?)
     drop primary key
     load new data
     load primary ke
     vacuum it

(2) drop table (this table has no trigger, no foreign key)
     re-create table (without primary key)
     load new data
     setup primary key
     vacuum it

suggestions PLEASE?

Thanks a lot!


In response to

Responses

pgsql-sql by date

Next:From: A. KretschmerDate: 2008-07-24 14:17:13
Subject: Re: truncate vs. delete
Previous:From: Lennin CaroDate: 2008-07-24 13:58:10
Subject: Re: truncate vs. delete

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group