-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] get rid of joint PK, just use local_*_id #15
base: main
Are you sure you want to change the base?
Conversation
I believe the coverage reports are both commutative and associative (in other words, order independent and grouping independent). That is also something that should easily be verifiable with a fuzzer / property testing. But yes, it might be interesting to figure out what the actual perf implications here are. That info should help decide whether we want to pre-merge all individual coverage files within one upload, and maybe even batch multiple uploads? |
my idea for how to update foreign keys when merging isn't great:
if the temp table (or maybe we should attach a temp database) is in memory, building the ID map should be extremely fast? so the big question is how painful those joins would be. at this point, we don't have indexes on anything other than PKs (creating them is slow, having them slows down inserts, and they also bloat the db, so my plan was to defer creating them until post-merge if possible) the sql would look something like this (ish):
what i wanted to make work was:
but sqlite RETURNING clauses are only allowed to reference the table being modified |
i think this is true, so i suppose we could do a mergesort-style merge rather than merging all of the incremental results one-by-one |
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: