Query speedups (index optimizations + replacing hive_posts_view to speedup query planning)
We don't care about deleted replies, so just exclude counter_deleted != 0 from index to make it smaller (2 fields instead of 3). This is for further optimizing of bridge_get_account_posts_by_replies.
Query planning for hive_posts_view takes too long because it has many joins, but mostly the order of these joins isn't very important since they are simple 1-1 joins that don't filter the number of rows or add a lot of data, so replacing it with new get_post_view_by_id function which forces the join order to eliminate the planning time.
There's still a few usages of hive_posts_view in python code (and even a few in SQL files) that can be replaced later.
There's a lot of changes to queries in this commit, so it's possible that existing tests won't detect all problems from this commit...
Note: need to look into PARALLEL and see if this is something we can safely be adding to many of our functions.
Merge request reports
Activity
added enhancement label
added 1 commit
- 57d775c5 - [DLN] Add get_post_view_by_id to replace hive_post_view which has too long of...
added 1 commit
- 62ce71e3 - [DLN] Add get_post_view_by_id to replace hive_post_view which has too long of...
added 1 commit
- e738b6d5 - [DLN] upgrades for index changes, still needs change to upgrade_runtime_migration.sql
added 1 commit
- 819a0782 - [DLN] fix typo (get_hive_post_by_id instead of get_post_view_by_id)
added 1 commit
- 7325af47 - [DLN] so just found out db_upgrade.sh doesn't run by default in CI, which...
added 1 commit
- d56a2a05 - [DLN] Query planner got unexpectedly stupid after replacing hive_posts_view...
added 1 commit
- d6175ded - [DLN] Several of these queries could potentially have the same problem as...
added 1 commit
- 0ad50b8f - [DLN] Replaced more usages of hive_posts_view and added more CTEs around...
added 1 commit
- 3d77cc0d - [DLN] some more cleanup, still probably won't compile