Page 1 of 1

Is possible to remove Firebird deleted records from database

Posted: 17.06.2011, 18:08
by sfxcc
Is possible to remove Firebird deleted records from database????

i inserted records on a db till 130 MB

I deleted 100 mB .
I used Sweep from IBO but file still haves 130 MB.

How can i remove it from File ?????

And How can i change transact isolation to READ COMMIT on ZeosLib ????

Posted: 17.06.2011, 20:07
by Pitfiend
As long as I know that kind of operation depends on the engine features. For example in SQLite you have vacuum that remove unused space. I think that you need to take a look into the firebird sql dialect to find an equivalent. Take in mind that there's no guarantee to have one.

Posted: 18.06.2011, 14:40
by sfxcc
I have use Sweep from IBO doesnt this a firebird internal function ????

Posted: 18.06.2011, 20:42
by Pitfiend
Don't know, never used Firebird before.

Posted: 20.06.2011, 22:20
by seawolf
At the moment Zeos does not support this kind of command.
I mean this command are very specific so they are called by the firebird dll
but, are currently not supported

Posted: 22.06.2011, 04:10
by Pitfiend
I think that even if not supported by Zeoslib, you can still use that kind of specific commands through a zquery, don't you?

Posted: 22.06.2011, 08:59
by duzenko
I think firebird developers suppose that you should backup the database and then restore from the backup

Posted: 22.06.2011, 16:50
by seawolf
Is not so simple as you supporse.
Sweep command is a service command, so you need initialize it and then
execute it.
You can call the dlls, but it is not so simple becuse it is necessary call several
methods

Posted: 01.07.2011, 11:46
by sfxcc
Ok, but i uses the IBO program sweep (Pressd the button) so i should do the job and it still the same size.


???? not a backup.. because if is working on the client it should work all day (add remove records)
Who can i do remove the records without recreate and coping it "manually" (from one to other new database )

Posted: 01.07.2011, 14:26
by seawolf
Ok, you can call the gfix program instead of the dlls. Sounds good.
Eventually try this example

Sweep Database now

gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -sweep

Set Sweep Interval to 50000 transactions

gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -h 50000

Or call it every night :wink:

Posted: 03.07.2011, 09:11
by marsupilami
Hello sfxcc,

as far as I understand firebird, sweeping is not for actually shrinking the size of the database file. Sweeping checks the internal DB structures for outdated records and marks the space they occupy to be usable again. This way the engine can reuse the space for newly inserted records.
This means in normal operation the database file will only grow but never shrink. But normally the size of the file stabilizes after some time and only grows if you insert more records than you delete.
The only way of actually shrinking the size of the database file is to have a full backup - restore cycle.