QUERY PLAN
Aggregate (cost=23.93..23.94 rows=1 width=8)
-> Sort (cost=21.47..21.88 rows=164 width=611)
Sort Key: d.updated_at DESC
-> HashAggregate (cost=13.80..15.44 rows=164 width=611)
Group Key: d.id
-> Seq Scan on tbl_documents d (cost=0.00..13.39 rows=164 width=12)
Filter: (department_id = 2)