Cory Nelson wrote: 

> The phrase you're looking for here is "CIDR block".  

Well, I was avoiding the phrase on purpose :-).  I was worried that 
using another bit of jargon -- one that is even more opaque than 
"prefix" to someone unfamiliar with the space -- did not seem likely to 
help get the idea across.  But since you and this forum probably do not 
have a burning interest in the minutiae of my flawed writing process, I 
press on.  

> The way I'd handle this is something like this: 
> 
> Expand the prefix into the full feed:beef:0000:etc 
> 
> Insert into a table (start binary(16), mask_length int) 
> 
> select top 1 binary,length from table where start <= @input order by 
> binary desc 
> 
> Check if the row is inside the range returned.  This will take a single 
> index seek.  

Um.  This looks, wow, much simpler and better than the R*Tree trick.

I guess the only question is whether the binary search into the 
(traditional) index will cost more than the R*Tree traversal.  In a set 
of 10m records we expect to bounce 23 times in a traditional index, if 
my math is right.  Not sure how that compares to the R*Tree.  

I'll see if I can get an apples-to-apples performance comparison 
going (and will reply back with the results, in case folks are still 
interested).  

Thank you!

-- 
Eric A. Rubin-Smith

I'm just glad it'll be Clark Gable who's falling on his face and 
not Gary Cooper.
    -- Gary Cooper on his decision not to take the leading role in 
       "Gone With The Wind."
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to