Desired behavior
To get the maximum benefit of table partitioning, we'll need to ensure our DB queries for the content node table use the tree_id as a filter so the query planner can prune the partitions it will access while executing the query.
Current behavior
If we don't scope queries to a tree, we often use the node's PK, which won't necessarily get the benefit of partitioning.
Deliverables
- A cache using Redis hashes should be keyed by the node's PK and map to the node's tree ID
- The cache should query the DB if it doesn't contain the information, and populate the cache
- The cache should be updated when the node moves to a new tree (like to the trash tree)
- Any query to the
ContentNode table should utilize the cache and filter by tree_id
Suggestions
Value add
- We can ensure that queries are structured optimally for the most benefit from our DB partitioning
Possible tradeoffs
- There are some caveats to PKs on partitioned tables which could complicate the whole strategy but perhaps the cache strategy could be leveraged for getting around them.
Desired behavior
To get the maximum benefit of table partitioning, we'll need to ensure our DB queries for the content node table use the
tree_idas a filter so the query planner can prune the partitions it will access while executing the query.Current behavior
If we don't scope queries to a tree, we often use the node's PK, which won't necessarily get the benefit of partitioning.
Deliverables
ContentNodetable should utilize the cache and filter bytree_idSuggestions
Value add
Possible tradeoffs