add remove split language show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
ALTER TABLE
CREATE INDEX
VACUUM
CREATE FUNCTION
CREATE TRIGGER
SET
datetime sys_id cputil memfree sessnum util_lag mem_lag util_diff mem_diff util_change
2019-05-03 08:06:14+00 100 0.57 0.51 47 null null null null null
2019-05-03 08:11:14+00 100 0.47 0.62 43 0.57 0.51 -0.099999994 0.110000014 Down
2019-05-03 08:16:14+00 100 0.56 0.57 62 0.47 0.62 0.09 -0.050000012 Up
INSERT 0 3
setseed
SELECT 1
QUERY PLAN
Insert on public.mytable (cost=0.00..37.50 rows=0 width=0) (actual time=9756.991..9756.994 rows=0 loops=1)
  -> Subquery Scan on "*SELECT*" (cost=0.00..37.50 rows=1000 width=72) (actual time=38.773..1643.013 rows=219357 loops=1)
        Output: "*SELECT*".datetime, "*SELECT*".sys_id, "*SELECT*".cputil, "*SELECT*".memfree, "*SELECT*".sessnum, NULL::real, NULL::real, NULL::real, NULL::real, NULL::text
        -> Function Scan on pg_catalog.generate_series _ (cost=0.00..30.00 rows=1000 width=84) (actual time=38.765..1266.082 rows=219357 loops=1)
              Output: _.datetime, 100, round((random())::numeric, 2), round((random())::numeric, 2), ('100'::double precision * random())
              Function Call: generate_series('2019-05-03 08:16:14+00'::timestamp with time zone, '2021-06-03 00:00:00+00'::timestamp with time zone, '00:05:00'::interval)
Planning Time: 0.088 ms
Trigger tr_fill_calculated_columns: time=6396.419 calls=219357
Execution Time: 9757.940 ms
EXPLAIN
QUERY PLAN
Limit (cost=0.42..0.60 rows=1 width=16) (actual time=0.020..0.021 rows=1 loops=1)
  Output: cputil, memfree, datetime
  -> Index Scan Backward using dtidx on public.mytable (cost=0.42..9981.52 rows=55377 width=16) (actual time=0.020..0.020 rows=1 loops=1)
        Output: cputil, memfree, datetime
        Index Cond: (mytable.datetime < '2021-09-03 00:00:00+00'::timestamp with time zone)
Planning Time: 0.259 ms
Execution Time: 0.041 ms
EXPLAIN
QUERY PLAN
Limit (cost=0.42..0.50 rows=1 width=16) (actual time=0.008..0.008 rows=1 loops=1)
  Output: cputil, memfree, datetime
  -> Index Scan Backward using dtidx on public.mytable (cost=0.42..13112.38 rows=166131 width=16) (actual time=0.007..0.007 rows=1 loops=1)
        Output: cputil, memfree, datetime
Planning Time: 0.033 ms
Execution Time: 0.017 ms
EXPLAIN