QUERY PLAN
Group (cost=540.76..540.77 rows=1 width=386)
Group Key: r.id
-> Sort (cost=540.76..540.77 rows=1 width=386)
Sort Key: r.id
-> Nested Loop (cost=0.29..540.75 rows=1 width=386)
-> Seq Scan on tbl_approves r (cost=0.00..524.11 rows=2 width=386)
Filter: ((purchase_contract_id = ANY ('{4042,4041}'::integer[])) AND (status = 2))
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt1 (cost=0.29..8.31 rows=1 width=4)
Index Cond: ((object_id = r.id) AND (term_id = 17))
Filter: (taxonomy_id = 2100000000)