QUERY PLAN
Aggregate (cost=2583.10..2583.11 rows=1 width=8)
-> Sort (cost=2568.10..2570.60 rows=1000 width=1588)
Sort Key: (date(tt.dt)) DESC
-> HashAggregate (cost=2505.77..2518.27 rows=1000 width=1588)
Group Key: tt.dt, p.day_at, p.user_id
-> Hash Left Join (cost=2485.52..2498.27 rows=1000 width=16)
Hash Cond: (date(tt.dt) = p.day_at)
-> Function Scan on generate_series tt (cost=0.02..10.02 rows=1000 width=8)
-> Hash (cost=2469.46..2469.46 rows=1283 width=8)
-> Seq Scan on tbl_punch p (cost=0.00..2469.46 rows=1283 width=8)
Filter: (user_id = 1001)