[wip] get rid of joint PK, just use local_*_id #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
not currently working on this, just an idea for later
the idea behind the joint PK is that it makes records globally unique if we distribute processing to different hosts. when we merge all the reports together at the end, we can just union the tables and not worry about non-unique IDs or updating foreign keys
while the joint PK is way better than UUIDs perf-wise, profile data still shows a lot of time is spent updating indexes for the joint PK. if we switch to
INTEGER PRIMARY KEY
it's a good deal faster. a specific comparison:sqlite3VdbeExec
, with 1.04s of that insqlite3BTreeIndexMoveto
sqlite3VdbeExec
with 324ms of that insqlite3BTreeIndexMoveto
merging is also really an INSERT, so it also has to pay for index updates. while switching to
INTEGER PRIMARY KEY
would necessitate more work to update foreign keys, it's not clear whether that cost outweighs the savings from making index updates faster in both placesto decide whether to make this change, we need some data around merging: