Manually Running a Database Sweep

Manually Running a Database Sweep

The default database sweep value is 20000. If this value has been amended to Zero, it will be necessary to empty out accumulated 'garbage'. This can be achieved by either performing a Firebird Validate / Backup and Restore of the database, or manually initiating a sweep. In the case of manually initiating a sweep it should be noted, that, despite the garbage being maintained, you should still be conducting a 'regular' Firebird Backup and Restore to maintain table indexes, database error checking and re-compacting the database size.


A manual sweep does not require exclusive database access. however this should only be conducted when the database is 'quiet', eg: overnight when the database is not being fully utilised.

Determining the Current Garbage Size (optional):
To determine the current garbage size run the gstat -h command from a Command Prompt. Substitute the Firebird 'bin' folder path appropriate to its location on your server along with database path and name as necessary
eg:

cd C:\Program Files\Firebird\Firebird_2_5\bin
SET ISC_USER=SYSDBA
SET ISC_PASSWORD=masterkey
gstat -h "H:\Ostendo\Ostendo DB\Demo.fdb"


This will produce various statistics for for this database. The difference between the Oldest Transaction and the Oldest Active Transaction will give you the approx garbage size being stored in the database.

Running a Manual Sweep:
From the Command Prompt run the gfix -sweep command against the database. Substitute the Firebird 'bin' folder path appropriate to its location on your server along with database path and name as necessary
eg:

cd C:\Program Files\Firebird\Firebird_2_5\bin
SET ISC_USER=SYSDBA
SET ISC_PASSWORD=masterkey
gfix -sweep "H:\Ostendo\Ostendo DB\Demo.fdb"

Automating The Manual Sweep Process:
The above DOS Commands relating to a manual sweep can be included in a Batch File which could be scheduled to run via Windows Task Scheduler on a nightly basis

    • Related Articles

    • Database Sweep Interval Setting To Improve Performance

      Overview: Garbage Collection: This is the ongoing cleaning of the database and is performed in the background around the clock. This constantly reorganises the memory space used by the database. If you don't clean up the database performance will ...
    • Data Volumes and Impact on Performance

      Data Volumes This article explains how data volumes can influence performance and user experience. Apart from technical Firebird Database settings, Configuration settings within Ostendo can also affect performance. As sites run Ostendo and Freeway ...
    • Ostendo running slowly

      Some of the most common factors that could influence speed are: 1) Firebird database needs to be backed up & restored (effectively fixes indexing or data issues) 2) The server is not optimised as a database server (i.e. the disk configuration is ...
    • Performance Speed Test

      Sometimes it can be useful to conduct a speed test in order to benchmark read / write speed in a database. This is useful when attempting to diagnose a performance problem on a specific database within different environments. By running the speed ...
    • Increasing Firebird Performance

      Below are links to two articles relating to potentially increasing Firebird Performance https://ib-aid.com/en/articles/how-to-make-firebird-work-20-faster-at-windows-server-2016-in-less-than-1-minute/ ...