Skip to content
Snippets Groups Projects
Commit 3de84cbd authored by Marcin's avatar Marcin
Browse files

more complex indexes to speedup get_ranked_posts methods

notice 30x speedups for get_ranged_posts trending/hot
no slowdown noticed for other queries
verified on DB with ~47mln of blocks
parent 7f0fb4d6
Branches
Tags
2 merge requests!456Release candidate v1 24,!298more complex indexes to speedup get_ranked_posts methods
This commit is part of merge request !298. Comments created here will be created in the context of that merge request.
......@@ -107,12 +107,11 @@ class DbState:
'hive_posts_payout_at_idx',
'hive_posts_payout_idx',
'hive_posts_promoted_idx',
'hive_posts_sc_trend_id_idx',
'hive_posts_sc_hot_id_idx',
'hive_posts_sc_trend_id_is_paidout_idx',
'hive_posts_sc_hot_id_is_paidout_idx',
'hive_posts_block_num_idx',
'hive_posts_cashout_time_id_idx',
'hive_posts_updated_at_idx',
'hive_posts_is_paidout_idx',
'hive_posts_payout_plus_pending_payout_id',
'hive_votes_block_num_idx',
......
......@@ -144,13 +144,12 @@ def build_metadata():
sa.Index('hive_posts_payout_at_idx', 'payout_at'),
sa.Index('hive_posts_payout_idx', 'payout'),
sa.Index('hive_posts_promoted_idx', 'promoted'),
sa.Index('hive_posts_sc_trend_id_idx', 'sc_trend', 'id'),
sa.Index('hive_posts_sc_hot_id_idx', 'sc_hot', 'id'),
sa.Index('hive_posts_sc_trend_id_is_paidout_idx', 'sc_trend', 'id', 'is_paidout'),
sa.Index('hive_posts_sc_hot_id_is_paidout_idx', 'sc_hot', 'id', 'is_paidout'),
sa.Index('hive_posts_created_at_idx', 'created_at'),
sa.Index('hive_posts_block_num_idx', 'block_num'),
sa.Index('hive_posts_cashout_time_id_idx', 'cashout_time', 'id'),
sa.Index('hive_posts_updated_at_idx', sa.text('updated_at DESC')),
sa.Index('hive_posts_is_paidout_idx', 'is_paidout'),
sa.Index('hive_posts_payout_plus_pending_payout_id', sa.text('(payout+pending_payout), id'))
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment