Subject | Re: [firebird-support] How does sweeping works? |
---|---|
Author | Ann W. Harrison |
Post date | 2009-08-26T19:29:58Z |
Daniel Vogelbacher wrote:
the deleted rows have committed. Consider this case:
Transaction 1 starts:
select count(*) from t1;
21
Transaction 2 starts:
delete from t1;
commit;
Transaction 3 starts:
select count(*) from t1;
0
Transaction 1 continues:
select count(*) from t1:
21
The rows that transaction 2 deleted must persist until the end of
Transaction 1 and any other transactions that started before
Transaction 2.
are selectable: cooperative, separate thread, and hybrid. Cooperative
garbage collection makes each writing transaction responsible for
cleaning up old record versions when it needs space on a page. The
separate garbage collection thread runs periodically, depending on
system load. The hybrid mode uses cooperative garbage collection when
all of the old record is on the page that had to be written anyway.
If old record versions chain across pages, the record (page?) is put
on a list for the garbage collect thread.
The trade-off among these is not as obvious as it seems. In a heavily
loaded system, the garbage collect thread can starve, leading to a
serious sanitation crisis.
since it happens automatically, I wouldn't worry about it.
Cheers,
Ann
>The space becomes available after all transactions that could read
> If 1000 rows deleted by a commited transaction, is the space available
> immediately or only after GC runs?
the deleted rows have committed. Consider this case:
Transaction 1 starts:
select count(*) from t1;
21
Transaction 2 starts:
delete from t1;
commit;
Transaction 3 starts:
select count(*) from t1;
0
Transaction 1 continues:
select count(*) from t1:
21
The rows that transaction 2 deleted must persist until the end of
Transaction 1 and any other transactions that started before
Transaction 2.
>Garbage collection starts automatically. It runs in three modes, which
> Does the GC starts automatically (configurable?) or/and is it possible to
> start GC manually (without running sweep)?
are selectable: cooperative, separate thread, and hybrid. Cooperative
garbage collection makes each writing transaction responsible for
cleaning up old record versions when it needs space on a page. The
separate garbage collection thread runs periodically, depending on
system load. The hybrid mode uses cooperative garbage collection when
all of the old record is on the page that had to be written anyway.
If old record versions chain across pages, the record (page?) is put
on a list for the garbage collect thread.
The trade-off among these is not as obvious as it seems. In a heavily
loaded system, the garbage collect thread can starve, leading to a
serious sanitation crisis.
>That depends on the load and mix of reads and updates/deletes. But
> Is GC/sweeping required for fast select queries?
since it happens automatically, I wouldn't worry about it.
Cheers,
Ann
>