Skip to content
Snippets Groups Projects
Commit 4fe3504a authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Merge branch 'bw_condenser_get_trending_tags_opt' into 'develop'

condenser get trending tags opt

See merge request !365
parents 6e9db551 6b12aa76
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!365condenser get trending tags opt
......@@ -108,17 +108,17 @@ class DbState:
'hive_posts_root_id_id_idx',
'hive_posts_community_id_idx',
'hive_posts_category_id_idx',
'hive_posts_payout_at_idx',
'hive_posts_payout_idx',
'hive_posts_promoted_idx',
'hive_posts_sc_trend_id_is_paidout_idx',
'hive_posts_sc_hot_id_is_paidout_idx',
'hive_posts_promoted_id_idx',
'hive_posts_sc_trend_id_idx',
'hive_posts_sc_hot_id_idx',
'hive_posts_block_num_idx',
'hive_posts_block_num_created_idx',
'hive_posts_cashout_time_id_idx',
'hive_posts_updated_at_idx',
'hive_posts_payout_plus_pending_payout_id_is_paidout_idx',
'hive_posts_payout_plus_pending_payout_id_idx',
'hive_posts_category_id_payout_plus_pending_payout_depth_idx',
'hive_posts_api_helper_author_s_permlink_idx',
......
......@@ -139,18 +139,18 @@ def build_metadata():
sa.Index('hive_posts_parent_id_idx', 'parent_id'),
sa.Index('hive_posts_community_id_idx', 'community_id'),
sa.Index('hive_posts_category_id_idx', 'category_id'),
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_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_promoted_id_idx', 'promoted', 'id', postgresql_where=sql_text("NOT is_paidout AND counter_deleted = 0")),
sa.Index('hive_posts_sc_trend_id_idx', 'sc_trend', 'id', postgresql_where=sql_text("NOT is_paidout AND counter_deleted = 0 AND depth = 0")),
sa.Index('hive_posts_sc_hot_id_idx', 'sc_hot', 'id', postgresql_where=sql_text("NOT is_paidout AND counter_deleted = 0 AND depth = 0")),
sa.Index('hive_posts_author_id_created_at_idx', sa.text('author_id DESC, created_at DESC')),
sa.Index('hive_posts_block_num_idx', 'block_num'),
sa.Index('hive_posts_block_num_created_idx', 'block_num_created'),
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_payout_plus_pending_payout_id_is_paidout_idx', sa.text('(payout+pending_payout), id, is_paidout'))
sa.Index('hive_posts_payout_plus_pending_payout_id_idx', sa.text('(payout+pending_payout), id, is_paidout'), postgresql_where=sql_text("counter_deleted = 0 AND NOT is_paidout")),
sa.Index('hive_posts_category_id_payout_plus_pending_payout_depth_idx', sa.text('category_id, (payout+pending_payout), depth'), postgresql_where=sql_text("NOT is_paidout AND counter_deleted = 0"))
)
sa.Table(
......
......@@ -326,3 +326,34 @@ CREATE INDEX IF NOT EXISTS hive_notification_cache_dst_score_idx ON hive_notific
CREATE INDEX IF NOT EXISTS hive_feed_cache_block_num_idx on hive_feed_cache (block_num);
CREATE INDEX IF NOT EXISTS hive_feed_cache_created_at_idx on hive_feed_cache (created_at);
--- condenser_get_trending_tags optimizations and slight index improvements.
DROP INDEX IF EXISTS hive_posts_category_id_idx;
CREATE INDEX IF NOT EXISTS hive_posts_category_id_payout_plus_pending_payout_depth_idx ON hive_posts (category_id, (payout + pending_payout), depth)
WHERE NOT is_paidout AND counter_deleted = 0;
DROP INDEX IF EXISTS hive_posts_sc_trend_id_is_paidout_idx;
CREATE INDEX IF NOT EXISTS hive_posts_sc_trend_id_idx ON hive_posts USING btree (sc_trend, id)
WHERE NOT is_paidout AND counter_deleted = 0 AND depth = 0
;
DROP INDEX IF EXISTS hive_posts_sc_hot_id_is_paidout_idx;
CREATE INDEX IF NOT EXISTS hive_posts_sc_hot_id_idx ON hive_posts (sc_hot, id)
WHERE NOT is_paidout AND counter_deleted = 0 AND depth = 0
;
DROP INDEX IF EXISTS hive_posts_payout_plus_pending_payout_id_is_paidout_idx;
CREATE INDEX IF NOT EXISTS hive_posts_payout_plus_pending_payout_id_idx ON hive_posts ((payout + pending_payout), id)
WHERE counter_deleted = 0 AND NOT is_paidout
;
DROP INDEX IF EXISTS hive_posts_promoted_idx;
CREATE INDEX IF NOT EXISTS hive_posts_promoted_id_idx ON hive_posts (promoted, id)
WHERE NOT is_paidout AND counter_deleted = 0
;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment