Is possible to remove Firebird deleted records from database

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Is possible to remove Firebird deleted records from database

Post 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 ????
where's the code ..
User avatar
Pitfiend
Senior Boarder
Senior Boarder
Posts: 68
Joined: 12.12.2009, 07:27

Post 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.
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post by sfxcc »

I have use Sweep from IBO doesnt this a firebird internal function ????
where's the code ..
User avatar
Pitfiend
Senior Boarder
Senior Boarder
Posts: 68
Joined: 12.12.2009, 07:27

Post by Pitfiend »

Don't know, never used Firebird before.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post 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
User avatar
Pitfiend
Senior Boarder
Senior Boarder
Posts: 68
Joined: 12.12.2009, 07:27

Post 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?
duzenko
Senior Boarder
Senior Boarder
Posts: 53
Joined: 17.06.2009, 11:24

Post by duzenko »

I think firebird developers suppose that you should backup the database and then restore from the backup
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post 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
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post 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 )
where's the code ..
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post 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:
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Post 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.
Post Reply