Sean,

>
> To be clear, you are saying that if a row as an index on Field A which has
> 4 record versions (3 which can be dropped), and the value of the index for
> those versions where 1, 2, 3 and 4.  When the sweep encounters the row,
> when it "scrubs" version 1, if reads the index and tries to find the
> version 1 entry and clean it at the same time.  And so on. Correct?


It's more complicated than that. The relationship between record versions
and index entries is not 1:1. If the index key doesn't change when a record
is updated, there's no change to the index.  That's a huge win for stable
indexes like primary keys.  Furthermore, if a key value starts as "A" for
example, and is modified to "B", then modified back to "A", then back to
"B" again (4 record versions), the record will have two index entries, one
for "A" and one for "B".  So the garbage collector builds a list of
"staying" values and "going" values.  In the case of the A's and B's, if
only the two oldest record versions were garbage collected, then there
would be no change to the index.  If all three old versions went, then the
"A" entry would be removed.

What that means is that the garbage collector has to access all versions of
a record to decide which index entries can be removed, so there's no way to
clean the records first, then go back to get the index entries.  That's
particularly true since someone could have modified the record again,
during the sweep, and changed the key value back to "A".  There's no way to
know that the "A" is new without looking at the record version chain.

And to whoever speculated that sweep would block all other access, no,
that's no more true than any other application that scans the database.
 Sweep is just a normal low-level API application that relies on normal
Firebird record and page handling, including (especially) cooperative
garbage collection.  Everything will be slower given that there's a process
reading the whole database, but there should be no long blockages.

Cheers,

Ann
------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to