QUERY PLAN
Aggregate (cost=17.82..17.83 rows=1 width=8)
-> Sort (cost=16.94..17.09 rows=59 width=611)
Sort Key: d.updated_at DESC
-> HashAggregate (cost=14.61..15.20 rows=59 width=611)
Group Key: d.id
-> Seq Scan on tbl_documents d (cost=0.00..14.46 rows=59 width=12)
Filter: ((document_type_id = 111) AND (department_id = 2))