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?.
create table example_input(
asset_id uuid
,timestamp timestamp(0)
,metric_name text
,metric_value int);
insert into example_input values
('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:14','distance',100)
,('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:14','speed',60)
,('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:14','elevation',15)
,('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:14','distance',120)
,('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:14','speed',80)
,('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:19','distance',140)
,('07536cba-6e00-4b8a-be02-9509228f4bb0','2024-12-16 17:43:19','elevation',20)
returning *;
CREATE TABLE
asset_id timestamp metric_name metric_value
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:14 distance 100
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:14 speed 60
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:14 elevation 15
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:14 distance 120
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:14 speed 80
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:19 distance 140
07536cba-6e00-4b8a-be02-9509228f4bb0 2024-12-16 17:43:19 elevation 20
INSERT 0 7