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

Yet another "drop table vs delete" question

From: marek(dot)patrzek(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Yet another "drop table vs delete" question
Date: 2009-04-21 17:26:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I was wondering if dropping a table is more efficient in PostgreSQL
8.x in comparison to deleting it's content ?

To put you in the picture - I want to schedule via cron job some daily
data materialization. With the resource I got there are only those two

1) DROP statement:
a) DROP TABLE tmp;
b) CREATE TABLE tmp AS select * from ....;

2) DELETE statement:
b) INSERT INTO tmp SELECT * from ....;

tmp table doesn't have any index nor constraints.

The thing is, postgresql may leave some invalid content behind in both
situations. The real question is - which of those two options leaves
less garbage to be vaccumed ? At this point I don't relay care about
cost based efficiency but cutting down pg background work.


pgsql-general by date

Next:From: Robert MortonDate: 2009-04-21 17:32:36
Subject: Re: round behavior differs between 8.1.5 and 8.3.7
Previous:From: Alvaro HerreraDate: 2009-04-21 17:13:38
Subject: Re: trouble with to_char('L')

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