Thread: deleting records from a table

deleting records from a table

From
Mario Behring
Date:
Hi all,

Simple question: once I execute the delete statement, does it free disk space immediatelly? Does Postgres uses something like a datafile with a pre-defined size like Oracle does??

Please advise.

Thank you.

Mario


Don't get soaked. Take a quick peak at the forecast
with theYahoo! Search weather shortcut.

Re: deleting records from a table

From
Richard Broersma Jr
Date:
---> Simple question: once I execute the delete statement, does it free disk space immediatelly?
No.  deleted rows (in a sense) are simply marked as deleted and are made avaliable for being
written over by a new or updated tuple.  If you want to recover the space you can you TRUNCATE or
VACUUM FULL & possible REINDEX.

Regards,
Richard Broersma Jr.


Re: deleting records from a table

From
Richard Broersma Jr
Date:
> Thank you for your help.
> 
> I am already running the vacuumdb full.............after it finishes (I guess it will take a
> while to finish...) how should I execute this REINDEX ? Is there a single command to reindex the
> entire database?

Here is a link that describes its use:
http://www.postgresql.org/docs/8.2/interactive/app-reindexdb.html

Regards,
Richard Broersma Jr.


Re: deleting records from a table

From
Scott Marlowe
Date:
On Fri, 2007-01-12 at 11:45, Mario Behring wrote:
> Hi all,
> 
> Simple question: once I execute the delete statement, does it free
> disk space immediatelly? Does Postgres uses something like a datafile
> with a pre-defined size like Oracle does??
> 
Take a look here:

http://www.postgresql.org/docs/8.2/static/routine-vacuuming.html
http://www.postgresql.org/docs/8.2/static/mvcc-intro.html

That should explain the basics of mvcc and vacuuming as applies to
pgsql.


Re: deleting records from a table

From
Andrew Sullivan
Date:
On Fri, Jan 12, 2007 at 09:45:28AM -0800, Mario Behring wrote:
> Simple question: once I execute the delete statement, does it free
> disk space immediatelly? Does Postgres uses something like a
> datafile with a pre-defined size like Oracle does??

What others said; but note that a vacuumed table that has a number of
now-empty slots can actually be a performance advantage, because new
rows don't need to increase the size of the table's on-disk file (so
you incur slightly less I/O).  There's a "sweet spot" for this that
you can discover by testing.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
"The year's penultimate month" is not in truth a good way of saying
November.    --H.W. Fowler