diff --git a/hive/db/schema.py b/hive/db/schema.py
index a5a09dddeaeb56b3e1d0b191487af3d21317dae6..275d3d65d263e9d9c4e5bd965229dc87664b7533 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -564,6 +564,7 @@ def setup(db):
       "hive_posts_view.sql",
       "hive_votes_view.sql",
       "hive_muted_accounts_view.sql",
+      "hive_muted_accounts_by_id_view.sql",
       "hive_post_operations.sql",
       "head_block_time.sql",
       "update_feed_cache.sql",
diff --git a/hive/db/sql_scripts/bridge_get_discussion.sql b/hive/db/sql_scripts/bridge_get_discussion.sql
index b3f1304f3f12b91bd2df65d6070dcd737470688b..61d334333f69953aa7ddd9aca5c31fdb08d4ae0e 100644
--- a/hive/db/sql_scripts/bridge_get_discussion.sql
+++ b/hive/db/sql_scripts/bridge_get_discussion.sql
@@ -11,8 +11,10 @@ AS
 $function$
 DECLARE
     __post_id INT;
+    __observer_id INT;
 BEGIN
     __post_id = find_comment_id( _author, _permlink, True );
+    __observer_id = find_account_id(_observer, False);
     RETURN QUERY
     SELECT
         hpv.id,
@@ -60,13 +62,14 @@ BEGIN
             SELECT hp.id, hp.parent_id
             FROM hive_posts hp
             WHERE hp.id = __post_id
+            AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp.author_id))
             UNION ALL
             SELECT children.id, children.parent_id
             FROM hive_posts children
             JOIN child_posts ON children.parent_id = child_posts.id
             JOIN hive_accounts ON children.author_id = hive_accounts.id
-            WHERE children.counter_deleted = 0 AND
-            (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hive_accounts.name) ELSE True END)
+            WHERE children.counter_deleted = 0
+            AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = children.author_id))
         )
         SELECT hp2.id
         FROM hive_posts hp2
diff --git a/hive/db/sql_scripts/bridge_get_ranked_post_for_all.sql b/hive/db/sql_scripts/bridge_get_ranked_post_for_all.sql
index f0c2a9c871d408723c4c334bc4a91eac12546e62..229985da24c0e0e903384ecc76114f5f449a5612 100644
--- a/hive/db/sql_scripts/bridge_get_ranked_post_for_all.sql
+++ b/hive/db/sql_scripts/bridge_get_ranked_post_for_all.sql
@@ -5,8 +5,10 @@ AS
 $function$
 DECLARE
   __post_id INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -52,11 +54,11 @@ BEGIN
       FROM hive_posts hp1
           JOIN hive_accounts_view ha ON hp1.author_id = ha.id
       WHERE hp1.counter_deleted = 0 AND hp1.depth = 0 AND NOT ha.is_grayed AND ( __post_id = 0 OR hp1.id < __post_id )
+      AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.id DESC
       LIMIT _limit
   ) as created
   JOIN hive_posts_view hp ON hp.id = created.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY created.id DESC
   LIMIT _limit;
 END
@@ -71,8 +73,10 @@ $function$
 DECLARE
   __post_id INT;
   __hot_limit FLOAT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT hp.sc_hot INTO __hot_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -123,11 +127,11 @@ BEGIN
           hive_posts hp1
       WHERE hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_hot < __hot_limit OR ( hp1.sc_hot = __hot_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_hot DESC, hp1.id DESC
       LIMIT _limit
   ) as hot
   JOIN hive_posts_view hp ON hp.id = hot.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY hot.hot DESC, hot.id DESC
   LIMIT _limit;
 END
@@ -199,7 +203,6 @@ BEGIN
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -214,8 +217,10 @@ $function$
 DECLARE
   __post_id INT;
   __payout_limit hive_posts.payout%TYPE;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT ( hp.payout + hp.pending_payout ) INTO __payout_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -266,11 +271,11 @@ BEGIN
           hive_posts hp1
       WHERE hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth > 0
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -286,8 +291,10 @@ DECLARE
   __post_id INT;
   __payout_limit hive_posts.payout%TYPE;
   __head_block_time TIMESTAMP;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT ( hp.payout + hp.pending_payout ) INTO __payout_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -340,11 +347,11 @@ BEGIN
       WHERE hp1.counter_deleted = 0 AND NOT hp1.is_paidout
           AND ( ( NOT _bridge_api AND hp1.depth = 0 ) OR ( _bridge_api AND hp1.payout_at BETWEEN __head_block_time + interval '12 hours' AND __head_block_time + interval '36 hours' ) )
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -359,8 +366,10 @@ $function$
 DECLARE
   __post_id INT;
   __promoted_limit hive_posts.promoted%TYPE;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT hp.promoted INTO __promoted_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -411,11 +420,11 @@ BEGIN
           hive_posts hp1
       WHERE hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.promoted > 0
           AND ( __post_id = 0 OR hp1.promoted < __promoted_limit OR ( hp1.promoted = __promoted_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.promoted DESC, hp1.id DESC
       LIMIT _limit
   ) as promoted
   JOIN hive_posts_view hp ON hp.id = promoted.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY promoted.promoted DESC, promoted.id DESC
   LIMIT _limit;
 END
@@ -430,8 +439,10 @@ $function$
 DECLARE
   __post_id INT;
   __trending_limit FLOAT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT hp.sc_trend INTO __trending_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -482,11 +493,11 @@ BEGIN
           hive_posts hp1
       WHERE hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_trend < __trending_limit OR ( hp1.sc_trend = __trending_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_trend DESC, hp1.id DESC
       LIMIT _limit
   ) as trends
   JOIN hive_posts_view hp ON hp.id = trends.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY trends.trend DESC, trends.id DESC
   LIMIT _limit;
 END
diff --git a/hive/db/sql_scripts/bridge_get_ranked_post_for_communities.sql b/hive/db/sql_scripts/bridge_get_ranked_post_for_communities.sql
index 9604f9df717af89eeac5770c009e04443ad7f096..a6f1f91f72f4be3e7ef942a3ae43f75c25803aec 100644
--- a/hive/db/sql_scripts/bridge_get_ranked_post_for_communities.sql
+++ b/hive/db/sql_scripts/bridge_get_ranked_post_for_communities.sql
@@ -3,7 +3,11 @@ CREATE FUNCTION bridge_get_ranked_post_pinned_for_community( in _community VARCH
 RETURNS SETOF bridge_api_post
 AS
 $function$
-  SELECT
+DECLARE
+  __observer_id INT;
+BEGIN
+  __observer_id = find_account_id(_observer, False);
+  RETURN QUERY SELECT
       hp.id,
       hp.author,
       hp.parent_author,
@@ -45,11 +49,12 @@ $function$
       hive_posts_view hp
       JOIN hive_communities hc ON hc.id = hp.community_id
   WHERE hc.name = _community AND hp.is_pinned
-  AND (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
+  AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp.author_id))
   ORDER BY hp.id DESC
   LIMIT _limit;
+END
 $function$
-language sql STABLE;
+language plpgsql STABLE;
 
 DROP FUNCTION IF EXISTS bridge_get_ranked_post_by_trends_for_community;
 CREATE FUNCTION bridge_get_ranked_post_by_trends_for_community( in _community VARCHAR, in _author VARCHAR, in _permlink VARCHAR, in _limit SMALLINT, in _bridge_api BOOLEAN, in _observer VARCHAR )
@@ -59,8 +64,10 @@ $function$
 DECLARE
   __post_id INT;
   __trending_limit FLOAT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT hp.sc_trend INTO __trending_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -113,11 +120,11 @@ BEGIN
       WHERE hc.name = _community AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
          AND ( NOT _bridge_api OR NOT hp1.is_pinned ) -- concatenated with bridge_get_ranked_post_pinned_for_community when called for bridge_api
          AND ( __post_id = 0 OR hp1.sc_trend < __trending_limit OR ( hp1.sc_trend = __trending_limit AND hp1.id < __post_id ) )
+         AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_trend DESC, hp1.id DESC
       LIMIT _limit
   ) as trends
   JOIN hive_posts_view hp ON hp.id = trends.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY trends.trend DESC, trends.id DESC
   LIMIT _limit;
 END
@@ -132,8 +139,10 @@ $function$
 DECLARE
   __post_id INT;
   __promoted_limit hive_posts.promoted%TYPE;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT hp.promoted INTO __promoted_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -185,11 +194,11 @@ BEGIN
           JOIN hive_communities hc ON hp1.community_id = hc.id
       WHERE hc.name = _community AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.promoted > 0
           AND ( __post_id = 0 OR hp1.promoted < __promoted_limit OR ( hp1.promoted = __promoted_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.promoted DESC, hp1.id DESC
       LIMIT _limit
   ) as promoted
   JOIN hive_posts_view hp ON hp.id = promoted.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY promoted.promoted DESC, promoted.id DESC
   LIMIT _limit;
 END
@@ -205,8 +214,10 @@ DECLARE
   __post_id INT;
   __payout_limit hive_posts.payout%TYPE;
   __head_block_time TIMESTAMP;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id( _observer, False );
   IF __post_id <> 0 THEN
       SELECT ( hp.payout + hp.pending_payout ) INTO __payout_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -259,11 +270,11 @@ BEGIN
           JOIN hive_communities hc ON hp1.community_id = hc.id
       WHERE hc.name = _community AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.payout_at BETWEEN __head_block_time + interval '12 hours' AND __head_block_time + interval '36 hours'
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -278,8 +289,10 @@ $function$
 DECLARE
   __post_id INT;
   __payout_limit hive_posts.payout%TYPE;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT ( hp.payout + hp.pending_payout ) INTO __payout_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -331,11 +344,11 @@ BEGIN
           JOIN hive_communities hc ON hp1.community_id = hc.id
       WHERE hc.name = _community AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth > 0
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -408,7 +421,6 @@ BEGIN
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -423,8 +435,10 @@ $function$
 DECLARE
   __post_id INT;
   __hot_limit FLOAT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   IF __post_id <> 0 THEN
       SELECT hp.sc_hot INTO __hot_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
@@ -476,11 +490,11 @@ BEGIN
           JOIN hive_communities hc ON hp1.community_id = hc.id
       WHERE hc.name = _community AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_hot < __hot_limit OR ( hp1.sc_hot = __hot_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_hot DESC, hp1.id DESC
       LIMIT _limit
   ) as hot
   JOIN hive_posts_view hp ON hp.id = hot.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY hot.hot DESC, hot.id DESC
   LIMIT _limit;
 END
@@ -494,8 +508,10 @@ AS
 $function$
 DECLARE
   __post_id INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -541,15 +557,14 @@ BEGIN
       FROM
           hive_posts hp1
           JOIN hive_communities hc ON hp1.community_id = hc.id
-          JOIN hive_accounts_view ha ON hp1.author_id = ha.id
       WHERE hc.name = _community AND hp1.counter_deleted = 0 AND hp1.depth = 0
           AND ( NOT _bridge_api OR NOT hp1.is_pinned ) -- concatenated with bridge_get_ranked_post_pinned_for_community when called for bridge_api
-          AND NOT ha.is_grayed AND ( __post_id = 0 OR hp1.id < __post_id )
+          AND ( __post_id = 0 OR hp1.id < __post_id )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.id DESC
       LIMIT _limit
   ) as created
   JOIN hive_posts_view hp ON hp.id = created.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY created.id DESC
   LIMIT _limit;
 END
diff --git a/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql b/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql
index 1fc78b56bbc88db6c38aff2a2e04a3f2d76130ce..85b1aa130b6b4493d696d003c81ca7ace7de242b 100644
--- a/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql
+++ b/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql
@@ -52,7 +52,7 @@ BEGIN
       JOIN hive_subscriptions hs ON hp.community_id = hs.community_id
       JOIN hive_accounts_view ha ON ha.id = hp.author_id
   WHERE hs.account_id = __account_id AND hp.depth = 0 AND NOT ha.is_grayed AND ( __post_id = 0 OR hp.id < __post_id )
-  AND (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
+  AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __account_id AND muted_id = hp.author_id))
   ORDER BY hp.id DESC
   LIMIT _limit;
 END
@@ -117,7 +117,7 @@ BEGIN
       JOIN hive_subscriptions hs ON hp.community_id = hs.community_id
   WHERE hs.account_id = __account_id AND NOT hp.is_paidout AND hp.depth = 0
       AND ( __post_id = 0 OR hp.sc_hot < __hot_limit OR ( hp.sc_hot = __hot_limit AND hp.id < __post_id ) )
-      AND (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
+      AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __account_id AND muted_id = hp.author_id))
   ORDER BY hp.sc_hot DESC, hp.id DESC
   LIMIT _limit;
 END
@@ -187,11 +187,11 @@ BEGIN
           JOIN hive_subscriptions hs ON hp1.community_id = hs.community_id
       WHERE hs.account_id = __account_id AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth > 0
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __account_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -258,7 +258,7 @@ BEGIN
       JOIN hive_subscriptions hs ON hp.community_id = hs.community_id
   WHERE hs.account_id = __account_id AND NOT hp.is_paidout AND hp.payout_at BETWEEN __head_block_time + interval '12 hours' AND __head_block_time + interval '36 hours'
       AND ( __post_id = 0 OR ( hp.payout + hp.pending_payout ) < __payout_limit OR ( ( hp.payout + hp.pending_payout ) = __payout_limit AND hp.id < __post_id ) )
-      AND (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
+      AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __account_id AND muted_id = hp.author_id))
   ORDER BY ( hp.payout + hp.pending_payout ) DESC, hp.id DESC
   LIMIT _limit;
 END
@@ -323,7 +323,7 @@ BEGIN
       JOIN hive_subscriptions hs ON hp.community_id = hs.community_id
   WHERE hs.account_id = __account_id AND NOT hp.is_paidout AND hp.promoted > 0
       AND ( __post_id = 0 OR hp.promoted < __promoted_limit OR ( hp.promoted = __promoted_limit AND hp.id < __post_id ) )
-      AND (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
+      AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __account_id AND muted_id = hp.author_id))
   ORDER BY hp.promoted DESC, hp.id DESC
   LIMIT _limit;
 END
@@ -395,11 +395,11 @@ BEGIN
       WHERE
           hs.account_id = __account_id AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_trend < __trending_limit OR ( hp1.sc_trend = __trending_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __account_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_trend DESC, hp1.id DESC
       LIMIT _limit
   ) trending
   JOIN hive_posts_view hp ON trending.id = hp.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY trending.sc_trend DESC, trending.id DESC
   LIMIT _limit;
 END
@@ -465,7 +465,6 @@ BEGIN
       JOIN hive_accounts_view ha ON ha.id = hp.author_id
   WHERE hs.account_id = __account_id AND NOT hp.is_paidout AND ha.is_grayed AND ( hp.payout + hp.pending_payout ) > 0
       AND ( __post_id = 0 OR ( hp.payout + hp.pending_payout ) < __payout_limit OR ( ( hp.payout + hp.pending_payout ) = __payout_limit AND hp.id < __post_id ) )
-      AND (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE True END)
   ORDER BY ( hp.payout + hp.pending_payout ) DESC, hp.id DESC
   LIMIT _limit;
 END
diff --git a/hive/db/sql_scripts/bridge_get_ranked_post_for_tag.sql b/hive/db/sql_scripts/bridge_get_ranked_post_for_tag.sql
index 04c4522953335c4963bcdd42f296cd16a3e3b460..3b1851cbfe66f866872f85b9d0caafdcc9e3c96b 100644
--- a/hive/db/sql_scripts/bridge_get_ranked_post_for_tag.sql
+++ b/hive/db/sql_scripts/bridge_get_ranked_post_for_tag.sql
@@ -6,9 +6,11 @@ $function$
 DECLARE
   __post_id INT;
   __hive_tag INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
   __hive_tag = find_tag_id( _tag, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -57,11 +59,11 @@ BEGIN
           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 )
       --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
+      AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.id DESC
       LIMIT _limit
   ) as created
   JOIN hive_posts_view hp ON hp.id = created.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY created.id DESC
   LIMIT _limit;
 END
@@ -77,12 +79,14 @@ DECLARE
   __post_id INT;
   __hot_limit FLOAT;
   __hive_tag INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
   IF __post_id <> 0 THEN
       SELECT hp.sc_hot INTO __hot_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
   __hive_tag = find_tag_id( _tag, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -131,11 +135,11 @@ BEGIN
           JOIN hive_posts hp1 ON hp1.id = hpt.post_id
       WHERE hpt.tag_id = __hive_tag AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_hot < __hot_limit OR ( hp1.sc_hot = __hot_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_hot DESC, hp1.id DESC
       LIMIT _limit
   ) as hot
   JOIN hive_posts_view hp ON hp.id = hot.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY hot.hot DESC, hot.id DESC
   LIMIT _limit;
 END
@@ -210,7 +214,6 @@ BEGIN
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -226,12 +229,14 @@ DECLARE
   __post_id INT;
   __payout_limit hive_posts.payout%TYPE;
   __hive_category INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
   IF __post_id <> 0 THEN
       SELECT ( hp.payout + hp.pending_payout ) INTO __payout_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
   __hive_category = find_category_id( _category, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -279,11 +284,11 @@ BEGIN
           hive_posts hp1
       WHERE hp1.category_id = __hive_category AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth > 0
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -300,6 +305,7 @@ DECLARE
   __payout_limit hive_posts.payout%TYPE;
   __head_block_time TIMESTAMP;
   __hive_category INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
   IF __post_id <> 0 THEN
@@ -307,6 +313,7 @@ BEGIN
   END IF;
   __hive_category = find_category_id( _category, True );
   __head_block_time = head_block_time();
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -355,11 +362,11 @@ BEGIN
       WHERE hp1.category_id = __hive_category AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout
           AND ( ( NOT _bridge_api AND hp1.depth = 0 ) OR ( _bridge_api AND hp1.payout_at BETWEEN __head_block_time + interval '12 hours' AND __head_block_time + interval '36 hours' ) )
           AND ( __post_id = 0 OR ( hp1.payout + hp1.pending_payout ) < __payout_limit OR ( ( hp1.payout + hp1.pending_payout ) = __payout_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY ( hp1.payout + hp1.pending_payout ) DESC, hp1.id DESC
       LIMIT _limit
   ) as payout
   JOIN hive_posts_view hp ON hp.id = payout.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY payout.all_payout DESC, payout.id DESC
   LIMIT _limit;
 END
@@ -375,12 +382,14 @@ DECLARE
   __post_id INT;
   __promoted_limit hive_posts.promoted%TYPE;
   __hive_tag INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
   IF __post_id <> 0 THEN
       SELECT hp.promoted INTO __promoted_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
   __hive_tag = find_tag_id( _tag, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -429,11 +438,11 @@ BEGIN
           JOIN hive_posts hp1 ON hp1.id = hpt.post_id
       WHERE hpt.tag_id = __hive_tag AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.promoted > 0
           AND ( __post_id = 0 OR hp1.promoted < __promoted_limit OR ( hp1.promoted = __promoted_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.promoted DESC, hp1.id DESC
       LIMIT _limit
   ) as promoted
   JOIN hive_posts_view hp ON hp.id = promoted.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY promoted.promoted DESC, promoted.id DESC
   LIMIT _limit;
 END
@@ -449,12 +458,14 @@ DECLARE
   __post_id INT;
   __trending_limit FLOAT;
   __hive_tag INT;
+  __observer_id INT;
 BEGIN
   __post_id = find_comment_id( _author, _permlink, True );
   IF __post_id <> 0 THEN
       SELECT hp.sc_trend INTO __trending_limit FROM hive_posts hp WHERE hp.id = __post_id;
   END IF;
   __hive_tag = find_tag_id( _tag, True );
+  __observer_id = find_account_id(_observer, False);
   RETURN QUERY SELECT
       hp.id,
       hp.author,
@@ -503,11 +514,11 @@ BEGIN
       JOIN hive_posts hp1 ON hp1.id = hpt.post_id
       WHERE hpt.tag_id = __hive_tag AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_trend < __trending_limit OR ( hp1.sc_trend = __trending_limit AND hp1.id < __post_id ) )
+          AND (NOT EXISTS (SELECT 1 FROM muted_accounts_by_id_view WHERE observer_id = __observer_id AND muted_id = hp1.author_id))
       ORDER BY hp1.sc_trend DESC, hp1.id DESC
       LIMIT _limit
   ) as trends
   JOIN hive_posts_view hp ON hp.id = trends.id
-  WHERE (CASE WHEN _observer IS NOT NULL THEN NOT EXISTS (SELECT 1 FROM muted_accounts_view WHERE observer = _observer AND muted = hp.author) ELSE true END)
   ORDER BY trends.trend DESC, trends.id DESC
   LIMIT _limit;
 END
diff --git a/hive/db/sql_scripts/db_upgrade.sh b/hive/db/sql_scripts/db_upgrade.sh
index 67aadeb0e08d3a6bf3df81f4cdd00ba8809298e5..e36f95428121a8b7b70ee778ca36244599932915 100755
--- a/hive/db/sql_scripts/db_upgrade.sh
+++ b/hive/db/sql_scripts/db_upgrade.sh
@@ -15,6 +15,7 @@ for sql in postgres_handle_view_changes.sql \
           hive_posts_view.sql \
           hive_votes_view.sql \
           hive_muted_accounts_view.sql \
+          hive_muted_accounts_by_id_view.sql \
           hive_post_operations.sql \
           head_block_time.sql \
           update_feed_cache.sql \
diff --git a/hive/db/sql_scripts/hive_muted_accounts_by_id_view.sql b/hive/db/sql_scripts/hive_muted_accounts_by_id_view.sql
new file mode 100644
index 0000000000000000000000000000000000000000..1fddfa778ee99410c2bfea5b76803408e72a1f96
--- /dev/null
+++ b/hive/db/sql_scripts/hive_muted_accounts_by_id_view.sql
@@ -0,0 +1,16 @@
+DROP VIEW IF EXISTS muted_accounts_by_id_view CASCADE;
+CREATE OR REPLACE VIEW muted_accounts_by_id_view AS
+SELECT observer_accounts.id AS observer_id,
+    following_accounts.id AS muted_id
+   FROM ((hive_follows
+     JOIN hive_accounts following_accounts ON ((hive_follows.following = following_accounts.id)))
+     JOIN hive_accounts observer_accounts ON ((hive_follows.follower = observer_accounts.id)))
+  WHERE (hive_follows.state = 2)
+UNION
+ SELECT observer_accounts.id AS observer_id,
+    following_accounts.id AS muted_id
+   FROM (((hive_follows hive_follows_direct
+     JOIN hive_follows hive_follows_indirect ON ((hive_follows_direct.following = hive_follows_indirect.follower)))
+     JOIN hive_accounts following_accounts ON ((hive_follows_indirect.following = following_accounts.id)))
+     JOIN hive_accounts observer_accounts ON ((hive_follows_direct.follower = observer_accounts.id)))
+  WHERE (hive_follows_direct.follow_muted AND (hive_follows_indirect.state = 2));
\ No newline at end of file