Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize querying with latest_run_required_tags (dagster-io#20333)
## Summary & Motivation Previously, if you had many upstream updated partitions, we'd need to do an individual "latest_materialization_record" query for each of them. Now, we take advantage of the fact that we do a single batched fetch of the latest materialization storage ids for each upstream partition, meaning we know the storage ids of all the records we need to fetch. From there, we can do a single call (per upstream asset, assuming there aren't more than 10,000 updated partitions) to fetch the records for each of those storage ids. After doing some perf-checking, this is not actually a silver bullet, as if there is only a single upstream partition that needs to be checked, the perf gain is pretty unimpressive. It's basically just that the query time no longer scales very quickly in relation to the number of upstream updated partitions. So before if there were 100 upstream updated partitions that needed to get queried, that'd take like 20 seconds, and now it'll still take ~1 second. ## How I Tested These Changes
- Loading branch information