QUERY PLAN
Sort (cost=2561.93..2564.43 rows=1000 width=370)
Sort Key: (date(tt.dt))
-> HashAggregate (cost=2494.60..2512.10 rows=1000 width=370)
Group Key: tt.dt, p.day_at, p.user_id
-> Hash Left Join (cost=2474.35..2487.10 rows=1000 width=354)
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=2466.65..2466.65 rows=615 width=346)
-> Bitmap Heap Scan on tbl_punch p (cost=1180.06..2466.65 rows=615 width=346)
Recheck Cond: (user_id = 1015)
-> Bitmap Index Scan on tbl_punch_pkey (cost=0.00..1179.90 rows=615 width=0)
Index Cond: (user_id = 1015)