Subject | How does sweeping works? |
---|---|
Author | Daniel Vogelbacher |
Post date | 2009-08-26T17:38:32Z |
Hi all,
I've tested serveral big databases (0.5-2gb) with sweeping disabled.
The database starts at a size of 10mb.
- start transaction
- insertion of 1.000.000 records
- rollback
-> database grows up to 100mb
- start transaction
- insertion of 1.000.000 records
- rollback
-> database grows up to ~160mb
Any insertions grows up the database, even if the transaction is rolled
back. This is the expected behavior (right?).
After running a sweep manually with gfix, it seems that
the "unused" rows/pages are used for insertion, the file doesn't
grows.
Running an "insertion - commit - delete all - commit - insertion"
consumes only ~10mb more (with and without sweeping after delete-all.
Since sweeping take care only about rolled back transactions, that
seems ok.
But I can't find an answer why there are ~10mb more needed.
If I understand all the documention about sweeping right,
deleted row-space is reused for insertion.
Row-space which was free'd by a rollback only becomes reused if a
database sweep runs.
The database size never shrinks (like on VACUUM in other db systems),
thats only possible with backup&restore.
...right?
Does sweeping - or disabled sweeping - affects the query speed in some way?
Daniel
--
web: http://daniel.vogelbacher.name
irc: cytrinox @ (freenode|ircnet|quakenet)
I've tested serveral big databases (0.5-2gb) with sweeping disabled.
The database starts at a size of 10mb.
- start transaction
- insertion of 1.000.000 records
- rollback
-> database grows up to 100mb
- start transaction
- insertion of 1.000.000 records
- rollback
-> database grows up to ~160mb
Any insertions grows up the database, even if the transaction is rolled
back. This is the expected behavior (right?).
After running a sweep manually with gfix, it seems that
the "unused" rows/pages are used for insertion, the file doesn't
grows.
Running an "insertion - commit - delete all - commit - insertion"
consumes only ~10mb more (with and without sweeping after delete-all.
Since sweeping take care only about rolled back transactions, that
seems ok.
But I can't find an answer why there are ~10mb more needed.
If I understand all the documention about sweeping right,
deleted row-space is reused for insertion.
Row-space which was free'd by a rollback only becomes reused if a
database sweep runs.
The database size never shrinks (like on VACUUM in other db systems),
thats only possible with backup&restore.
...right?
Does sweeping - or disabled sweeping - affects the query speed in some way?
Daniel
--
web: http://daniel.vogelbacher.name
irc: cytrinox @ (freenode|ircnet|quakenet)