"HashAggregate (cost=1149724.56..1149724.83 rows=2732 width=35)" " -> Nested Loop (cost=1.12..1149667.02 rows=11508 width=35)" " -> Nested Loop (cost=0.84..1146212.12 rows=11719 width=43)" " -> Nested Loop (cost=0.42..1138733.06 rows=11719 width=43)" " -> Seq Scan on graphs g (cost=0.00..1134045.02 rows=2732 width=35)" " Filter: ((flags = ANY ('{0,4}'::integer[])) AND (NOT (SubPlan 2)) AND (NOT (SubPlan 3)) AND (NOT (SubPlan 1)))" " SubPlan 2" " -> HashAggregate (cost=6.88..6.89 rows=1 width=12)" " Filter: ((max(r_1.permission) < 2) OR (min(r_1.permission) IS NULL) OR (min(r_1.permission) = 0))" " -> Result (cost=0.85..6.87 rows=1 width=12)" " One-Time Filter: (g.ymin_type = 2)" " -> Nested Loop Left Join (cost=0.85..6.87 rows=1 width=12)" " -> Nested Loop (cost=0.70..6.71 rows=1 width=16)" " -> Index Scan using items_pkey on items i_2 (cost=0.42..4.42 rows=1 width=8)" " Index Cond: (g.ymin_itemid = itemid)" " -> Index Only Scan using hosts_groups_1 on hosts_groups hgg_1 (cost=0.28..2.29 rows=1 width=16)" " Index Cond: (hostid = i_2.hostid)" " -> Index Scan using rights_2 on rights r_1 (cost=0.14..0.16 rows=1 width=12)" " Index Cond: (id = hgg_1.groupid)" " Filter: (groupid = ANY ('{7,11}'::bigint[]))" " SubPlan 3" " -> HashAggregate (cost=6.88..6.89 rows=1 width=12)" " Filter: ((max(r_2.permission) < 2) OR (min(r_2.permission) IS NULL) OR (min(r_2.permission) = 0))" " -> Result (cost=0.85..6.87 rows=1 width=12)" " One-Time Filter: (g.ymax_type = 2)" " -> Nested Loop Left Join (cost=0.85..6.87 rows=1 width=12)" " -> Nested Loop (cost=0.70..6.71 rows=1 width=16)" " -> Index Scan using items_pkey on items i_3 (cost=0.42..4.42 rows=1 width=8)" " Index Cond: (g.ymax_itemid = itemid)" " -> Index Only Scan using hosts_groups_1 on hosts_groups hgg_2 (cost=0.28..2.29 rows=1 width=16)" " Index Cond: (hostid = i_3.hostid)" " -> Index Scan using rights_2 on rights r_2 (cost=0.14..0.16 rows=1 width=12)" " Index Cond: (id = hgg_2.groupid)" " Filter: (groupid = ANY ('{7,11}'::bigint[]))" " SubPlan 1" " -> GroupAggregate (cost=1.12..259.29 rows=8 width=12)" " Filter: ((max(r.permission) < 2) OR (min(r.permission) IS NULL) OR (min(r.permission) = 0))" " -> Nested Loop Left Join (cost=1.12..259.17 rows=8 width=12)" " Join Filter: (r.id = hgg.groupid)" " -> Nested Loop (cost=1.12..256.21 rows=8 width=16)" " Join Filter: (i_1.hostid = hgg.hostid)" " -> Index Only Scan using hosts_groups_1 on hosts_groups hgg (cost=0.28..84.84 rows=4261 width=16)" " -> Materialize (cost=0.84..41.00 rows=6 width=8)" " -> Nested Loop (cost=0.84..40.97 rows=6 width=8)" " -> Index Only Scan using graphs_items_mix_ind on graphs_items gi_1 (cost=0.42..14.42 rows=6 width=8)" " Index Cond: (graphid = g.graphid)" " -> Index Scan using items_pkey on items i_1 (cost=0.42..4.43 rows=1 width=16)" " Index Cond: (itemid = gi_1.itemid)" " -> Materialize (cost=0.00..2.57 rows=10 width=12)" " -> Seq Scan on rights r (cost=0.00..2.52 rows=10 width=12)" " Filter: (groupid = ANY ('{7,11}'::bigint[]))" " -> Index Only Scan using graphs_items_mix_ind on graphs_items gi (cost=0.42..1.72 rows=6 width=16)" " Index Cond: (graphid = g.graphid)" " -> Index Scan using items_pkey on items i (cost=0.42..0.64 rows=1 width=16)" " Index Cond: (itemid = gi.itemid)" " -> Index Scan using hosts_hostid_ind on hosts h (cost=0.28..0.29 rows=1 width=8)" " Index Cond: (hostid = i.hostid)" " Filter: (status <> 3)"