Skip to content
Snippets Groups Projects
Commit 2cb703f1 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

Improvements of sql query for get_discussions

- Added author_id to hive_posts_view,
- Removed inner join on hive_accounts in get_discussions sql query
parent 502165ad
No related branches found
No related tags found
4 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!53get_discussion SQL query fixes
......@@ -595,6 +595,7 @@ def setup(db):
hp.community_id,
hp.parent_id,
ha_a.name AS author,
hp.author_id,
hpd_p.permlink,
hpd.title,
hpd.body,
......
......@@ -35,10 +35,10 @@ async def get_discussion(context, author, permlink, observer=None):
hpv.promoted, hpv.payout, hpv.payout_at,
hpv.is_paidout, hpv.children, hpv.votes,
hpv.created_at, hpv.updated_at, hpv.rshares,
hpv.json, hive_accounts.reputation AS author_rep,
hpv.json, hpv.author_rep,
hpv.is_hidden, hpv.is_grayed,
hpv.total_votes, hpv.flag_weight,
hpv.sc_trend, hive_accounts.id AS acct_author_id,
hpv.sc_trend, hpv.author_id AS acct_author_id,
hpv.root_author, hpv.root_permlink, hpv.parent_author, hpv.parent_permlink,
hpv.allow_replies, hpv.allow_votes,
hpv.allow_curation_rewards, hpv.url, hpv.root_title, hpv.beneficiaries,
......@@ -46,7 +46,6 @@ async def get_discussion(context, author, permlink, observer=None):
FROM
child_posts
INNER JOIN hive_posts_view hpv ON (hpv.id = child_posts.id)
INNER JOIN hive_accounts ON (hive_accounts.name = hpv.author)
WHERE NOT hpv.is_deleted AND NOT hpv.is_muted
LIMIT 2000
"""
......
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