QUERY PLAN
Sort (cost=173.03..173.38 rows=139 width=21)
Sort Key: (count(c.id)) DESC
-> HashAggregate (cost=166.69..168.08 rows=139 width=21)
Group Key: u.id
-> Hash Join (cost=9.13..150.42 rows=3255 width=17)
Hash Cond: (c.created_by = u.id)
-> Seq Scan on tbl_contacts c (cost=0.00..132.49 rows=3255 width=8)
Filter: ((id IS NOT NULL) AND (client_id IS NOT NULL))
-> Hash (cost=7.39..7.39 rows=139 width=13)
-> Seq Scan on tbl_users u (cost=0.00..7.39 rows=139 width=13)