QUERY PLAN
Sort (cost=366.19..366.19 rows=1 width=330)
Sort Key: i.left_at DESC
-> Group (cost=366.16..366.18 rows=1 width=330)
Group Key: i.id, client.id
-> Sort (cost=366.16..366.17 rows=1 width=314)
Sort Key: i.id, client.id
-> Nested Loop Left Join (cost=0.28..366.15 rows=1 width=314)
-> Seq Scan on tbl_implement_records i (cost=0.00..357.85 rows=1 width=310)
Filter: (case_id = 9240)
-> Index Only Scan using tbl_clients_pkey on tbl_clients client (cost=0.28..8.29 rows=1 width=4)
Index Cond: (id = i.client_id)