On 07/02/2012 04:29 PM, Niall O'Reilly wrote:

On 29 Jun 2012, at 23:58, Richard Hipp wrote:

But you know:  How often do people use BLOBs as keys?  What other SQL
engines other than SQLite even allow BLOBs as keys?  Are we trying to
optimize something that is never actually used?

        For an IPAM application I have on my back burner, BLOB seems
        a natural way to express IPv[46] addresses, ranges, and prefixes.
        A bulkier alternative would be hexadecimal encoding as text.

That would be a reasonable use. But the blob in this case will be what,
eight bytes (or 10 in its encoded form)? So the encoding and decoding
(it's actually not clear we will ever want to decode, but anyhow) isn't
going to cost much in the way of CPU. And making the keys memcmp()
compatible allows some other optimizations - prefix compression and so
on. Plus I think memcmp() will be generally faster than any other
type of comparison.

Creating and using an index on larger blobs might be different of
course.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to