QUERY PLAN
Aggregate (cost=217.96..217.97 rows=1 width=8)
-> Sort (cost=202.07..204.72 rows=1059 width=1827)
Sort Key: c.pinyin1, c.namecut1, c.pinyin2, c.namecut2, c.pinyin3, c.namecut3, c.pinyin4, c.namecut4, c.created_by, c.created_at DESC
-> HashAggregate (cost=138.28..148.87 rows=1059 width=1827)
Group Key: c.id
-> Seq Scan on tbl_contacts c (cost=0.00..135.63 rows=1059 width=44)
Filter: ((supplier_id IS NOT NULL) AND ((supplier_id IS NOT NULL) OR (client_id IS NOT NULL)))