New db_layout:
uri_id (p) | lookup_id (f) | new_uri_id | old_uri_id | --------------------------------------------------------- 1 | 1234 | 2 | -1 2 | 1235 | -1 | 1 3 | 1234 | -1 | -1
Lookup Table: id <-> uri:
lookup_id (p) | value --------------- 1234 | foo.txt 1235 | bar.txt
(p) - primary key (f) - foreign key
This solves the previous mentioned problems, but breaks compatibility with the old db schema. It don't know, how SQLite actually optimise the old schema, but I think a good DBMS should do this already.
New db_layout:
uri_id (p) | lookup_id (f) | new_uri_id | old_uri_id | ------- ------- ------- ------- ------- ------- ------- -
-------
1 | 1234 | 2 | -1
2 | 1235 | -1 | 1
3 | 1234 | -1 | -1
Lookup Table: id <-> uri:
lookup_id (p) | value
---------------
1234 | foo.txt
1235 | bar.txt
(p) - primary key
(f) - foreign key
This solves the previous mentioned problems, but breaks compatibility with the old db schema.
It don't know, how SQLite actually optimise the old schema, but I think a good DBMS should do this already.