QUERY PLAN
Group (cost=4491.31..4492.99 rows=171 width=4)
Group Key: in_device
-> Sort (cost=4491.31..4492.15 rows=336 width=4)
Sort Key: in_device
-> Seq Scan on tbl_punch (cost=0.00..4477.21 rows=336 width=4)
Filter: ((in_device IS NOT NULL) AND (user_id = 1001))