QUERY PLAN
Group (cost=2482.97..2484.59 rows=161 width=4)
Group Key: in_device
-> Sort (cost=2482.97..2483.78 rows=324 width=4)
Sort Key: in_device
-> Seq Scan on tbl_punch (cost=0.00..2469.46 rows=324 width=4)
Filter: ((in_device IS NOT NULL) AND (user_id = 1001))