QUERY PLAN
Sort (cost=2461.30..2463.80 rows=1000 width=363)
Sort Key: (date(tt.dt)) DESC
-> HashAggregate (cost=2393.97..2411.47 rows=1000 width=363)
Group Key: tt.dt, p.day_at, p.user_id
-> Hash Left Join (cost=2373.72..2386.47 rows=1000 width=347)
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=2349.76..2349.76 rows=1915 width=339)
-> Seq Scan on tbl_punch p (cost=0.00..2349.76 rows=1915 width=339)
Filter: (user_id = 1000)