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=8432.361..8432.362 rows=0 loops=1) |
| -> Subquery Scan on "*SELECT*" (cost=0.00..37.50 rows=1000 width=72) (actual time=37.526..1406.066 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=37.519..1099.757 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.056 ms |
| Trigger tr_fill_calculated_columns: time=5627.789 calls=219357 |
| Execution Time: 8433.093 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Limit (cost=0.42..0.61 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..10301.52 rows=55377 width=16) (actual time=0.015..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.079 ms |
| Execution Time: 0.028 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Limit (cost=0.42..0.50 rows=1 width=16) (actual time=0.009..0.010 rows=1 loops=1) |
| Output: cputil, memfree, datetime |
| -> Index Only Scan Backward using dtidx on public.mytable (cost=0.42..14080.38 rows=166131 width=16) (actual time=0.009..0.009 rows=1 loops=1) |
| Output: cputil, memfree, datetime |
| Heap Fetches: 1 |
| Planning Time: 0.035 ms |
| Execution Time: 0.019 ms |
EXPLAIN