QUERY PLAN
HashAggregate (cost=14.39..14.48 rows=9 width=158)
Group Key: dd.id
-> Hash Join (cost=1.20..14.33 rows=12 width=158)
Hash Cond: (d.department_id = dd.id)
-> Seq Scan on tbl_documents d (cost=0.00..13.09 rows=12 width=16)
Filter: (created_by = 1000)
-> 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)