QUERY PLAN
GroupAggregate (cost=1504.00..1504.02 rows=1 width=48)
Group Key: tt.id
-> Sort (cost=1504.00..1504.01 rows=1 width=24)
Sort Key: tt.id
-> Nested Loop Left Join (cost=0.29..1503.99 rows=1 width=24)
Join Filter: (ttr.taxonomy_id = tt.id)
-> Nested Loop Left Join (cost=0.29..1493.09 rows=1 width=12)
-> Nested Loop (cost=0.00..1488.41 rows=1 width=12)
Join Filter: (d.id = dt.object_id)
-> Seq Scan on tbl_term_taxonomy_relationships dt (cost=0.00..1470.28 rows=1 width=4)
Filter: ((term_id = 7) AND (taxonomy_id = 116))
-> Seq Scan on tbl_documents d (cost=0.00..12.50 rows=450 width=16)
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships ttr (cost=0.29..4.67 rows=1 width=8)
Index Cond: ((object_id = d.id) AND (term_id = 7))
-> Seq Scan on tbl_term_taxonomies tt (cost=0.00..7.07 rows=307 width=16)