QUERY PLAN
HashAggregate (cost=379.90..382.43 rows=253 width=48)
Group Key: tt.id
-> Hash Left Join (cost=43.05..377.87 rows=407 width=23)
Hash Cond: (ttr.taxonomy_id = tt.id)
-> Merge Right Join (cost=34.36..368.09 rows=407 width=12)
Merge Cond: (ttr.object_id = d.id)
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships ttr (cost=0.29..1787.40 rows=410 width=8)
Index Cond: (term_id = 7)
-> Sort (cost=29.71..30.73 rows=407 width=16)
Sort Key: d.id
-> Seq Scan on tbl_documents d (cost=0.00..12.07 rows=407 width=16)
-> Hash (cost=5.53..5.53 rows=253 width=15)
-> Seq Scan on tbl_term_taxonomies tt (cost=0.00..5.53 rows=253 width=15)