Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I optimize table after delete many records

Tags:

sql

firebird

I deleted many records from my table but the DB size (Firebird) left the same. How do I decrease it?

I am looking for something similar to vacuum in PostgreS.

like image 775
rs. Avatar asked Nov 25 '25 00:11

rs.


2 Answers

This is one of many pains of firebird. Best and only effective and right way to do this - backup/restore your database using gbak

like image 162
Alexey Sviridov Avatar answered Nov 27 '25 14:11

Alexey Sviridov


Firebird will occasionally run a sweep to remove the records from indexes etc., and regain the space for other use. In other words, as soon as the sweep has run, you will have the same performance as if the database file was smaller. You can enforce an immediate sweep, if that is what you are trying to do.

However, the size of the actual database will not shrink, no matter what, except if you do a backup and restore. If size is a problem, use the -USE_ALL_SPACE parameter for gbak, it will prevent that space is being reserved for future records, which will yield a smaller database.

like image 29
Lars D Avatar answered Nov 27 '25 15:11

Lars D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!