QUERY PLAN
Aggregate (cost=14.51..14.52 rows=1 width=8)
-> Sort (cost=14.49..14.50 rows=1 width=611)
Sort Key: d.updated_at DESC
-> Group (cost=14.47..14.48 rows=1 width=611)
Group Key: d.id
-> Sort (cost=14.47..14.48 rows=1 width=12)
Sort Key: d.id
-> Seq Scan on tbl_documents d (cost=0.00..14.46 rows=1 width=12)
Filter: ((document_type_id = 41) AND (department_id = 2))