QUERY PLAN
Aggregate (cost=13.15..13.16 rows=1 width=8)
-> Sort (cost=13.12..13.12 rows=2 width=611)
Sort Key: d.updated_at DESC
-> Group (cost=13.10..13.11 rows=2 width=611)
Group Key: d.id
-> Sort (cost=13.10..13.10 rows=2 width=12)
Sort Key: d.id
-> Seq Scan on tbl_documents d (cost=0.00..13.09 rows=2 width=12)
Filter: (department_id = 10)