Well, I'm not really a database architect - I basically just thought quite a long time about how to make an universal schema and asked a friend who works with databases a bit. Well, like this, the lookup and store databases are independent - so when the lookup one is corrupted, it should be possible to regenerate it just form the stores. Yeah - say we have x=1 y=2 and z=17 -> 1217, also x=1,y=21,z=7 -> 1217 ... A hash with separators might work though: 1,2,17 vs 1,21,7 - would something like this be usable ? Also, would it be possible to maintain backward compatibility by adding this new indexes and still storing the old info ? Converting all the existing database files users might already have would be quite a headache and also some developers might be already working on supporting the format in its current form (IIRC the CloudGPS developer, maybe also some others). There is a version filed in the schema, so it would be possible to do something like this:1 = current version 2 = old info + new indexes 3 = just new indexes
CREATE TABLE tiles (z INTEGER, x INTEGER, y INTEGER, store_filename STRING, extension varchar(10), unix_epoch_timestamp INTEGER, store_tilenumber INTEGER, lookup STRING, PRIMARY KEY(lookup)); CREATE TABLE version (v integer); CREATE INDEX oldindex on tiles (z,x,y);
CREATE TABLE tiles (z INTEGER, x INTEGER, y INTEGER, tile BLOB, extension VARCHAR(10), unix_epoch_timestamp INTEGER, id INTEGER AUTO INCREMENT, PRIMARY KEY(id)); CREATE TABLE version (v integer); CREATE INDEX oldindex on tiles (z,x,y);