Subject | Re: FB-1.5.2 slow performance and high memory usage after insert and delete 30M |
---|---|
Author | Adam |
Post date | 2006-01-06T11:16:41Z |
--- In firebird-support@yahoogroups.com, "intellekta"
<uwe.cramer@i...> wrote:
were wrong and so deleted them. Deleting records in Firebird does not
physically remove the record (at first anyway). It simply flags it as
being deleted. This is because older transactions may still be
interested in seeing the previous value(s) before the delete. The same
is true for updates. New transactions wont see the deleted records.
Eventually, your database has no more active transactions that could
possibly see the previous values of the deleted transaction. At this
time, garbage collection does its work and frees up the space for re-use.
decide to rollback, less garbage is left lying around. The trade off
is that this log may grow significantly if your transaction lasts a
long time.
potentially be) interested in the previous value of the deleted
records. While this is the case, sweep can't do anything about it.
store the information on, the file size grows. File space is never
returned to the OS. Apart from being an enormous housekeeping job to
effectively defrag the pages, chances are you will need to request
disk space again, so why bother?
backing up more information.
that occurs while the backup is running (a nice side effect of a
nightly backup). Restore to a new database and see if the restored
database still has these problems.
which will allow garbage collection to work correctly.
doesn't keep switching CPUs (which can happen with SS and dual CPU on
Windows machines). If this happens, set the CPUAffinity mask in the
firebird.conf to lock fbserver to a single CPU.
Adam
<uwe.cramer@i...> wrote:
>OK, so you have inserted 30 million records, committed, realised they
> Hello,
> we have inserted and deleted ~ 30.000.000 records in a table.(buggy sp).
were wrong and so deleted them. Deleting records in Firebird does not
physically remove the record (at first anyway). It simply flags it as
being deleted. This is because older transactions may still be
interested in seeing the previous value(s) before the delete. The same
is true for updates. New transactions wont see the deleted records.
Eventually, your database has no more active transactions that could
possibly see the previous values of the deleted transaction. At this
time, garbage collection does its work and frees up the space for re-use.
> after that the client performance slows down to 1/10 and the memoryFirebird maintains an undo log (for a while anyway) so that if you
> usage in fbserver goes from ~200KB to ~800KB.
decide to rollback, less garbage is left lying around. The trade off
is that this log may grow significantly if your transaction lasts a
long time.
> sweep does not change this situation.Possibly you still have an active transaction that is (or rather could
potentially be) interested in the previous value of the deleted
records. While this is the case, sweep can't do anything about it.
> the database filesize goes from ~14GB to ~22GBThis is normal. You added more data, Firebird needed more pages to
store the information on, the file size grows. File space is never
returned to the OS. Apart from being an enormous housekeeping job to
effectively defrag the pages, chances are you will need to request
disk space again, so why bother?
> the backup filessize after sweep is a little bit bigger as it was inThat does not make sense. It should be the same size unless you are
> the past.
backing up more information.
> backup takes ~5 times longer as before.Try using the -g switch of gbak. This prevents the garbage collection
that occurs while the backup is running (a nice side effect of a
nightly backup). Restore to a new database and see if the restored
database still has these problems.
> any suggestions to resolve this, except complete restore from a backup?Restarting the server process will abandon any active transactions,
which will allow garbage collection to work correctly.
> Thanks in advanceLooking at your specs, you may need to watch that the fbserver process
> Uwe Cramer
> additional conf infos:
> OS = W2K SP4
> HW = HP DL380 / 2GB / 2xXeon 3.0GHz
> FB = SS Mode
> firebird.conf without any change / all options with # comment
>
doesn't keep switching CPUs (which can happen with SS and dual CPU on
Windows machines). If this happens, set the CPUAffinity mask in the
firebird.conf to lock fbserver to a single CPU.
Adam