QUERY PLAN
Aggregate (cost=95.44..95.45 rows=1 width=32)
-> Group (cost=95.16..95.25 rows=7 width=265)
Group Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 5250)) THEN 1 ELSE 0 END), r.id
-> Sort (cost=95.16..95.18 rows=7 width=10)
Sort Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 5250)) THEN 1 ELSE 0 END) DESC, r.id
-> Nested Loop Left Join (cost=0.57..95.06 rows=7 width=10)
-> Nested Loop (cost=0.28..84.88 rows=7 width=14)
-> Seq Scan on tbl_approve_verify_rels rvr (cost=0.00..34.79 rows=7 width=8)
Filter: (user_id = 5250)
-> Index Scan using tbl_approves_pkey on tbl_approves r (cost=0.28..7.15 rows=1 width=18)
Index Cond: (id = rvr.approve_id)
Filter: (status <> 0)
-> Index Only Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt1 (cost=0.29..1.44 rows=1 width=4)
Index Cond: ((object_id = r.id) AND (term_id = 17))