QUERY PLAN
Aggregate (cost=164.50..164.51 rows=1 width=8)
-> Sort (cost=163.78..163.90 rows=48 width=2971)
Sort Key: (CASE c.user_status WHEN 3 THEN 1 WHEN 1 THEN 0 ELSE c.user_status END) DESC, c.updated_at DESC
-> Group (cost=161.96..162.44 rows=48 width=2971)
Group Key: c.id
-> Sort (cost=161.96..162.08 rows=48 width=16)
Sort Key: c.id
-> Nested Loop (cost=0.28..160.62 rows=48 width=16)
-> Index Only Scan using tbl_suppliers_pkey on tbl_suppliers supplier (cost=0.28..8.29 rows=1 width=4)
Index Cond: (id = 138)
-> Seq Scan on tbl_contacts c (cost=0.00..151.85 rows=48 width=20)
Filter: (supplier_id = 138)