QUERY PLAN
Group (cost=724.91..724.92 rows=1 width=386)
Group Key: r.id
-> Sort (cost=724.91..724.92 rows=1 width=386)
Sort Key: r.id
-> Nested Loop (cost=0.29..724.90 rows=1 width=386)
-> Seq Scan on tbl_approves r (cost=0.00..570.77 rows=19 width=386)
Filter: ((status = 2) AND (purchase_contract_id = ANY ('{4079,4077,4074,4040,4007,3976,3970,3968,3948,3933,3907,3898,3894,3990,3860,3859,3847,3843,3830,3826}'::integer[])))
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt1 (cost=0.29..8.10 rows=1 width=4)
Index Cond: ((object_id = r.id) AND (term_id = 17))
Filter: (taxonomy_id = 2100000000)