QUERY PLAN
Limit (cost=156.77..156.78 rows=1 width=154)
-> Sort (cost=156.77..156.78 rows=1 width=154)
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=156.75..156.76 rows=1 width=154)
Group Key: c.id
-> Sort (cost=156.75..156.75 rows=1 width=150)
Sort Key: c.id
-> Nested Loop (cost=0.28..156.74 rows=1 width=150)
-> Seq Scan on tbl_contacts c (cost=0.00..148.44 rows=1 width=150)
Filter: (supplier_id = 511)
-> Index Only Scan using tbl_suppliers_pkey on tbl_suppliers supplier (cost=0.28..8.29 rows=1 width=4)
Index Cond: (id = 511)