QUERY PLAN
Sort (cost=2459.69..2462.19 rows=1000 width=362)
Sort Key: (date(tt.dt))
-> HashAggregate (cost=2392.37..2409.87 rows=1000 width=362)
Group Key: tt.dt, p.day_at, p.user_id
-> Hash Left Join (cost=2372.12..2384.87 rows=1000 width=346)
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=2364.22..2364.22 rows=630 width=338)
-> Bitmap Heap Scan on tbl_punch p (cost=1114.72..2364.22 rows=630 width=338)
Recheck Cond: (user_id = 5388)
-> Bitmap Index Scan on tbl_punch_pkey (cost=0.00..1114.57 rows=630 width=0)
Index Cond: (user_id = 5388)