QUERY PLAN
Aggregate (cost=2474.00..2474.01 rows=1 width=8)
-> Sort (cost=2459.00..2461.50 rows=1000 width=1588)
Sort Key: (date(tt.dt)) DESC
-> HashAggregate (cost=2396.67..2409.17 rows=1000 width=1588)
Group Key: tt.dt, p.day_at, p.user_id
-> Hash Left Join (cost=2376.42..2389.17 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=2351.20..2351.20 rows=2016 width=8)
-> Seq Scan on tbl_punch p (cost=0.00..2351.20 rows=2016 width=8)
Filter: (user_id = 1011)