TFDFBNBackup "don't use garbage collection" switch (-G in gbak)

234 views
Skip to first unread message

Midsoft UK

unread,
Jul 9, 2021, 11:35:36 AM7/9/21
to firebird-support
Hi

is there an option for TFDFBNBackup  to simulate the -G switch in Gbak. Or another to ignore deletes records when backing in order to shrink a database?

Thanks

Mark Rotteveel

unread,
Jul 9, 2021, 11:39:16 AM7/9/21
to firebird...@googlegroups.com
Judging by its name and its documentation, this class is for nbackup,
not gbak, so it doesn't have this option, as nbackup doesn't do any
garbage collection.

As an aside, even in gbak, performing garbage collection does not shrink
a database. Firebird databases do not shrink, though internally space
will be freed up and resued. Shrinking a database can only be done by
backing up and restoring using gbak.

Mark
--
Mark Rotteveel

Midsoft UK

unread,
Jul 9, 2021, 11:43:06 AM7/9/21
to firebird-support
I was just about to ask which is better - 

tFDIBBackup  or tFDFBNBackup

There is this option in  tFDIBBackup

That's what I meant about shrinking, using backup and restore.  So the shrinking only happens on the restore ?

So  tFDIBBackup isn;t the same as using GBak ?

Cheers

Mark Rotteveel

unread,
Jul 9, 2021, 11:53:49 AM7/9/21
to firebird...@googlegroups.com
On 09-07-2021 17:43, Midsoft UK wrote:
> I was just about to ask which is better -
>
> tFDIBBackup  or tFDFBNBackup
>
> There is this option in tFDIBBackup
>
> That's what I meant about shrinking, using backup and restore.  So the
> shrinking only happens on the restore ?
>
> So tFDIBBackup isn;t the same as using GBak ?

I have no idea, I don't program in Delphi. It might be better to ask
such questions on a forum about Firebird and Delpi, not on
firebird-support (which is more for questions about Firebird itself).

Mark
--
Mark Rotteveel

Carlos H. Cantu

unread,
Jul 9, 2021, 4:42:00 PM7/9/21
to Midsoft UK

I was just about to ask which is better -

tFDIBBackup  or tFDFBNBackup

There is this option in  tFDIBBackup

That's what I meant about shrinking, using backup and restore.

There is no shrinking in Firebird databases. The fact that a fresh restored database usually is smaller than the original database is because the original database usually has "garbage" occuping space. This space will be used to store new data, aftter the garbage collector marks it as reusable. A fresh restored dartabase has no garbage at all, that's why it is smaller. If you do a backup/restore followed by another backup/restore, you will see that the final sizes of both restored DBs will be the same, since there was no garbage anymore in the original DB.

-g gbak switch will tell Firebird to not collect any garbage during the backup process. This usually speed up the backup process. How much depends on the amount of garbage present in the database. It is good to use -g if you plan to replace the original DB by a fresh restored version, since it doesn't make sense to collect garbage in a database that will be replaced.


So  tFDIBBackup isn;t the same as using GBak ?

It is almost the same thing. Basically, it is using the Service API to "run" gbak.

http://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Phys.IBBase.TFDIBBackup

"This is a programmatic method to invoke the gbak tool as a thread in the DB server process. "

[]s
Carlos
www.firebirdnews.org - www.FireBase.com.br
Reply all
Reply to author
Forward
0 new messages