db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bergquist, Brett" <BBergqu...@canoga.com>
Subject RE: Question about TRUNCATE TABLE and freeing disk space
Date Tue, 29 Mar 2011 17:40:04 GMT
Very good explanation!  Thank you very much.

-----Original Message-----
From: Mike Matrigali [mailto:mikem_app@sbcglobal.net] 
Sent: Tuesday, March 29, 2011 12:59 PM
To: derby-dev@db.apache.org
Subject: Re: Question about TRUNCATE TABLE and freeing disk space

In all these experiments it is important to note when a commit of the
transaction is done.  It is probably the case that autocommit is assumed
and each statement being discussed is a separate transaction.  But 
thought I would just raise the issue, derby definitely can not release
the space until the transaction doing the truncate commits.  This is why
the extra files are created on truncate and drop, so that if necessary
we can abort the change by reverting back to the saved files.

The cleanup of these extra files happen at checkpoint time as that is 
when we match up these objects with the transactions that created them
and if those transactions are committed or aborted then we can go ahead
and do the cleanup.

checkpoints happen automatically by the system at various times including:
o clean shutdown
o recurring while running based on amount of data logged
o when requested explicitly using procedure call

Maybe in your system with the system running "flat out" you are 
automatically generating the checkpoints in the background and this is
the difference between what you and rick are seeing.


Bergquist, Brett wrote:
> My point Dag is that even though I did not checkpoint the database, Derby released the
disk space back to the OS (Solaris 10) when I dropped the table, so my experience is not matching
what Rick had mentioned in that the disk space would not be released until a checkpoint. 
My experience is saying that the disk space was released immediately.
> Is there some implicit checkpoint being done?  Note that my utility is connecting to
the database using the network server mode and the database was not shutdown before the space
was released back to the OS.
> -----Original Message-----
> From: Dag H. Wanvik [mailto:dag.wanvik@oracle.com] 
> Sent: Tuesday, March 29, 2011 10:32 AM
> To: derby-dev@db.apache.org
> Subject: Re: Question about TRUNCATE TABLE and freeing disk space
> "Bergquist, Brett" <BBergquist@canoga.com> writes:
> immediately brought this down to 46Gb of disk space.  I do not have a "checkpoint" in
my utility application.
> You can call it from ij or via JDBC:
> http://db.apache.org/derby/docs/10.7/ref/rrefcheckpointdbproc.html
> Dag

View raw message