add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
50 rows affected
dte
2017-01-01
2017-02-01
2017-03-01
2017-04-01
2017-05-01
2017-06-01
2017-07-01
2017-08-01
2017-09-01
2017-10-01
2017-11-01
2017-12-01
dte total
2017-01-01 22030
2017-08-01 6794
2017-03-01 2958
2017-06-01 38278
2017-05-01 7798
2017-02-01 22753
2017-10-01 28576
2017-07-01 18736
2017-11-01 10172
2017-04-01 9456
2017-09-01 21033
2017-12-01 41901
pivotdata
{"2017-01": 22030, "2017-02": 22753, "2017-03": 2958, "2017-04": 9456, "2017-05": 7798, "2017-06": 38278, "2017-07": 18736, "2017-08": 6794, "2017-09": 21033, "2017-10": 28576, "2017-11": 10172, "2017-12": 41901}
jan feb mar apr may jun jul aug sep oct nov dec
22030 22753 2958 9456 7798 38278 18736 6794 21033 28576 10172 41901
dte customer_id
2017-01-01 00:00:00+00 1
2017-01-01 00:00:00+00 2
2017-02-01 00:00:00+00 1
2017-02-01 00:00:00+00 2
2017-03-01 00:00:00+00 1
2017-03-01 00:00:00+00 2
2017-04-01 00:00:00+01 1
2017-04-01 00:00:00+01 2
2017-05-01 00:00:00+01 1
2017-05-01 00:00:00+01 2
2017-06-01 00:00:00+01 1
2017-06-01 00:00:00+01 2
2017-07-01 00:00:00+01 1
2017-07-01 00:00:00+01 2
2017-08-01 00:00:00+01 1
2017-08-01 00:00:00+01 2
2017-09-01 00:00:00+01 1
2017-09-01 00:00:00+01 2
2017-10-01 00:00:00+01 1
2017-10-01 00:00:00+01 2
2017-11-01 00:00:00+00 1
2017-11-01 00:00:00+00 2
2017-12-01 00:00:00+00 1
2017-12-01 00:00:00+00 2
dte customer_id total
2017-12-01 00:00:00+00 2 27454
2017-03-01 00:00:00+00 1 2958
2017-09-01 00:00:00+01 1 14
2017-08-01 00:00:00+01 1 0
2017-01-01 00:00:00+00 1 0
2017-04-01 00:00:00+01 1 5399
2017-02-01 00:00:00+00 2 12583
2017-05-01 00:00:00+01 1 0
2017-10-01 00:00:00+01 1 15466
2017-06-01 00:00:00+01 1 14821
2017-11-01 00:00:00+00 2 6497
2017-07-01 00:00:00+01 1 7927
2017-03-01 00:00:00+00 2 0
2017-12-01 00:00:00+00 1 14447
2017-01-01 00:00:00+00 2 22030
2017-08-01 00:00:00+01 2 6794
2017-04-01 00:00:00+01 2 4057
2017-09-01 00:00:00+01 2 21019
2017-10-01 00:00:00+01 2 13110
2017-06-01 00:00:00+01 2 23457
2017-02-01 00:00:00+00 1 10170
2017-05-01 00:00:00+01 2 7798
2017-07-01 00:00:00+01 2 10809
2017-11-01 00:00:00+00 1 3675
customer_id pivotdata
1 {"2017-01": 0, "2017-02": 10170, "2017-03": 2958, "2017-04": 5399, "2017-05": 0, "2017-06": 14821, "2017-07": 7927, "2017-08": 0, "2017-09": 14, "2017-10": 15466, "2017-11": 3675, "2017-12": 14447}
2 {"2017-01": 22030, "2017-02": 12583, "2017-03": 0, "2017-04": 4057, "2017-05": 7798, "2017-06": 23457, "2017-07": 10809, "2017-08": 6794, "2017-09": 21019, "2017-10": 13110, "2017-11": 6497, "2017-12": 27454}
customer_id jan feb mar apr may jun jul aug sep oct nov dec
1 0 10170 2958 5399 0 14821 7927 0 14 15466 3675 14447
2 22030 12583 0 4057 7798 23457 10809 6794 21019 13110 6497 27454