Hello,

 

I was wondering whether there was a good way to calculate the amount of space that my derby database is currently using.

 

In the application that I’m working on, I have to keep that last X megabytes of data (where X is a user definable value).  The overriding table of information is the items table that has two CLOBs in it:

 

Items {

ID

.

.

CLOB

CLOB

}

 

Is there a way to query derby to find out how much space it is using so that I can delete some items and then “reclaim” the space with:

 

call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP', ‘ITEMS’, 0);

 

or

 

SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE(
               IN SCHEMANAME VARCHAR(128),
               IN TABLENAME VARCHAR(128),
               IN PURGE_ROWS SMALLINT,
               IN DEFRAGMENT_ROWS SMALLINT,
               IN TRUNCATE_END SMALLINT )

 

The documentation states: Unlike SYSCS_UTIL.SYSCS_COMPRESS_TABLE(), all work is done in place in the existing table/index.

 

Does that mean that the first call creates a new set of files and copies itself over there and when that is complete, the old files are deleted?

 

 

 

Or is the only way to do this to add a “SUM” column to that table and then perform the following query:

 

SELECT SUM(size) FROM Items;

 

And then delete appropriately?

 

(Sorry if this is answered somewhere, I searched through the documentation for everything that I could think of.)

 

Thanks,

Adam