[BioSQL-l] left_value and right_value in taxon table

Hilmar Lapp hlapp at gmx.net
Tue Apr 8 23:57:41 UTC 2008


On Apr 8, 2008, at 11:58 AM, aaron.j.mackey at gsk.com wrote:
> I believe that the first thing the load_ncbi_taxonomy.pl script  
> does is to
> wipe out everything already in the table.

That may have been in true in its beginnings but hasn't been for a  
long time :-) It only updates changed nodes, adds new ones, and  
deletes retired ones (unless you say --nodelete). The script does  
recompute *all* nested set values, though.

> [...]
> depending on the type of update you're making (e.g. you only add  
> one new
> terminal taxonomic node, having no children), the incremental  
> updates are
> pretty fast, computationally speaking (no tree traversal is  
> required).  I
> won't be able to recite them off the top of my head, but Joe  
> Celko's "SQL
> For Smarties" book has the necessary code.  In a nutshell, it's  
> something
> like if the overall topology of the tree remains unchanged, you'll  
> need to
> increment the right/left values of each node "to the right" of the new
> node you've inserted by 2, but it's a tiny bit more complicated  
> than that.

Though you can have very cheap cases indeed, in reality it turns out  
that on average you still need to traverse and update at least half  
of the nodes, so personally I really doubt you would save any  
significant amount of time by not just redoing all of them. And it's  
not that time-intensive either; typically it takes about 10-20mins,  
depending on CPU etc.

	-hilmar
-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================






More information about the BioSQL-l mailing list