On 25 mai 2011, at 10:40, Jan Hudec wrote: > Since "integer primary key" is faster than "primary > key (object_id, side)" and since the rows are mostly handled independenty > (and have many other things refer to them), I construct a primary key with: > > object_id | (side << 63) [...] > Regards, > Jan
Interesting. I too use an integer primary key as a bitfield. Specifically, I need to identify a data record in a three-dimensional space (a data cube), and my key is: (z << 16) + (y << 8) + x This works for me because the three dimensions I use (x, y, z here) are positive integral values that can never exceed 255. Clearly, I won't be affected by the overflow issue you discovered. I hope there aren't other pitfalls when using a primary key as a bitfield. JD _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users