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=13859.346..13859.347 rows=0 loops=1)
  -> Subquery Scan on "*SELECT*" (cost=0.00..37.50 rows=1000 width=72) (actual time=46.166..2252.260 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=46.160..1755.709 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.068 ms
Trigger tr_fill_calculated_columns: time=9036.443 calls=219357
Execution Time: 13860.206 ms
EXPLAIN
QUERY PLAN
Limit (cost=0.42..0.60 rows=1 width=16) (actual time=0.015..0.016 rows=1 loops=1)
  Output: cputil, memfree, datetime
  -> Index Only Scan Backward using dtidx on public.mytable (cost=0.42..10193.52 rows=55377 width=16) (actual time=0.014..0.015 rows=1 loops=1)
        Output: cputil, memfree, datetime
        Index Cond: (mytable.datetime < '2021-09-03 00:00:00+00'::timestamp with time zone)
        Heap Fetches: 1
Planning Time: 0.084 ms
Execution Time: 0.030 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 Only Scan Backward using dtidx on public.mytable (cost=0.42..13756.38 rows=166131 width=16) (actual time=0.007..0.008 rows=1 loops=1)
        Output: cputil, memfree, datetime
        Heap Fetches: 1
Planning Time: 0.040 ms
Execution Time: 0.019 ms
EXPLAIN