Optimization: only issue new dependency tasks for "parent" documents which contain a pinned relation(list) to "child" document
sandreae opened this issue · 1 comments
In our dependency task we need to account for cases when a newly reduced document may have skipped over a view which is pinned from another document (this happens when operations are batched). In this case we want to issue new dependency tasks for any of these "parent" documents (the document which contained the pinned relation). We currently do this by issuing dependency tasks for all documents where their schema contains a pinned relation to the schema of the newly reduced document. We could improve this a bit by identifying documents which actually contain the pinned relation we are looking for. This can be done by querying operation values which are of type pinned_relation
or pinned_relation_list
where the value
matches any child_document_view_id
for the current document.
It's really similar to what we do when identifying if a blob should be garbage collected (basically, it has no "parent" documents) here:
aquadoggo/aquadoggo/src/db/stores/blob.rs
Lines 324 to 370 in a24b2d8
It would be worth discussing whether this is actually an optimization, we would be swapping fewer tasks issued for a more complex (but maybe not that complex?) query.