Closed KOLANICH closed 6 years ago
Hi!
Maybe you can use a primary key on multiple columns.
But unfortunately this is not the right place for general SQLite questions. You can join the sqlite-users mailing list and send an e-mail to it.
If you have any problem specific to LiteTree, feel comfortable to report here.
Hi. I guess it may be not a right place to post a bug report, but I gonna post it here since sqlite project has some issues with its bug tracker and maillist.
The problem is that I need FAST lookup by 2 indexex and ranges. Currently I solve this problem by packing 2 numbers into one rowid by concatenating, I mean
major_index << n_bits | minor_index
and lookups likewhere oid == (major_index << n_bits | minor_index)
andwhere oid >= major_index << n_bits and oid <= major_index << n_bits | minor_index_mask
. This solves the problem pretty well, but ... this ruins schema since parts of rowid cannot be a part of schema, I cannot store this relation in DB and make DB engine enforce consistency. I mean thatmajor_index
is a foreign key referring a primary key in another table.I wonder if it makes sense have this feature built into the db.