Re: Yet another "drop table vs delete" question - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Yet another "drop table vs delete" question
Date
Msg-id 20090421193006.GT10358@alvh.no-ip.org
Whole thread Raw
In response to Yet another "drop table vs delete" question  (marek.patrzek@gmail.com)
Responses Re: Yet another "drop table vs delete" question
List pgsql-general
marek.patrzek@gmail.com escribió:
> I was wondering if dropping a table is more efficient in PostgreSQL
> 8.x in comparison to deleting it's content ?

"8.x" is a meaningless version number in Postgres.  Major versions (with
new features, etc) are labeled by the first two elements, so 8.0, 8.1,
and so on.

To actually answer your question,

> 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.

Try TRUNCATE.  That leaves the less garbage behind and takes the less
time.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: PostgreSQL versus MySQL for GPS Data
Next
From: Alvaro Herrera
Date:
Subject: Re: PostgreSQL versus MySQL for GPS Data