Subject | Re: [firebird-support] Database size and garbage collection |
---|---|
Author | Ann W. Harrison |
Post date | 2005-09-14T22:02:53Z |
ed_heiberger wrote:
One way to force it to happen is to use gbak to backup the database or
the sweep option of gfix.
than it would be with more frequent "select *" statements. Select count
(*) is cheaper. If you know some range of values that are common to
deleted records, select count(*) from table where <condition> is faster yet.
down if you free up space occupied by deleted records.
and -a options and gives a long report describing data an index
distributions etc.
Regards,
Ann
>>Normally that happens during a range or exhaustive retrieval of a table.
>>Even when that condition is meet, the record is only garbage
>>collected when some transaction tries to read it, so gstat may be
>>counting records that are awaiting garbage collection.
>
> Can anyone help explain the "Even when this condition ..." part?
> Why would my application ever try to read a record it has deleted?
One way to force it to happen is to use gbak to backup the database or
the sweep option of gfix.
>A nightly backup would also work. The database file might be bigger
> Because, I have a similar problem where the database file grows
> constantly. The application does a lot of record deletes. I'm
> using the native Firebird C interfaces in my application.
>
> I "fixed" the application by adding an SQL query after every 100
> deletions. A simple query "select * from mytable" seems to do the
> trick.
than it would be with more frequent "select *" statements. Select count
(*) is cheaper. If you know some range of values that are common to
deleted records, select count(*) from table where <condition> is faster yet.
> When I run the same test with the "fixed"You'll never see the file get smaller, but the rate of growth will go
> application, the database file grows to a fixed size and stays
> there.
down if you free up space occupied by deleted records.
>These numbers are perfectly fine. The gstat I was describing uses the -r
> Here's gstat output after a test run where the database grew through
> out the test cycle.
>
> Database header page information:
> Flags 0
> Checksum 12345
> Generation 50041
> Page size 4096
> ODS version 10.0
> Oldest transaction 50036
> Oldest active 50037
> Oldest snapshot 50037
> Next transaction 50038
>
and -a options and gives a long report describing data an index
distributions etc.
Regards,
Ann