Skip to content
Snippets Groups Projects
Commit 43c653ac authored by Marcin's avatar Marcin
Browse files

speed up bridge_get_ranked_post_by_created_for_tag

Workaround with 'id + 0'  which previously speed up the query
after some time fails and has to be removed because it slow down
get_ranked_post.
parent ebdc2e99
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!344Mi slow get ranked post
...@@ -55,7 +55,8 @@ BEGIN ...@@ -55,7 +55,8 @@ BEGIN
JOIN hive_posts hp1 ON hp1.id = hpt.post_id JOIN hive_posts hp1 ON hp1.id = hpt.post_id
JOIN hive_accounts_view ha ON hp1.author_id = ha.id JOIN hive_accounts_view ha ON hp1.author_id = ha.id
WHERE hpt.tag_id = __hive_tag AND hp1.counter_deleted = 0 AND hp1.depth = 0 AND NOT ha.is_grayed AND ( __post_id = 0 OR hp1.id < __post_id ) WHERE hpt.tag_id = __hive_tag AND hp1.counter_deleted = 0 AND hp1.depth = 0 AND NOT ha.is_grayed AND ( __post_id = 0 OR hp1.id < __post_id )
ORDER BY hp1.id + 0 DESC --ORDER BY hp1.id + 0 DESC -- this workaround helped the query to better choose indexes, but after some time it started to significally slow down
ORDER BY hp1.id DESC
LIMIT _limit LIMIT _limit
) as created ) as created
JOIN hive_posts_view hp ON hp.id = created.id JOIN hive_posts_view hp ON hp.id = created.id
......
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