QUERY PLAN
Aggregate (cost=1302.08..1302.09 rows=1 width=32)
-> Group (cost=1258.84..1272.36 rows=1081 width=265)
Group Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END), r.id
-> Sort (cost=1258.84..1261.55 rows=1081 width=10)
Sort Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END) DESC, r.id
-> Hash Right Join (cost=170.88..1204.37 rows=1081 width=10)
Hash Cond: (dt1.object_id = r.id)
-> Seq Scan on tbl_term_taxonomy_relationships dt1 (cost=0.00..1019.58 rows=1620 width=4)
Filter: (term_id = 17)
-> Hash (cost=157.36..157.36 rows=1081 width=14)
-> Hash Join (cost=119.71..157.36 rows=1081 width=14)
Hash Cond: (rvr.approve_id = r.id)
-> Seq Scan on tbl_approve_verify_rels rvr (cost=0.00..34.79 rows=1087 width=8)
Filter: (user_id = 1001)
-> Hash (cost=98.91..98.91 rows=1664 width=18)
-> Seq Scan on tbl_approves r (cost=0.00..98.91 rows=1664 width=18)
Filter: (status <> 0)