QUERY PLAN
HashAggregate (cost=17.69..17.78 rows=9 width=158)
Group Key: dd.id
-> Hash Join (cost=1.20..15.44 rows=450 width=158)
Hash Cond: (d.department_id = dd.id)
-> Seq Scan on tbl_documents d (cost=0.00..12.50 rows=450 width=16)
-> Hash (cost=1.09..1.09 rows=9 width=150)
-> Seq Scan on tbl_departments dd (cost=0.00..1.09 rows=9 width=150)
Filter: (id IS NOT NULL)