forked from ddrilling/AsbCloudServer
80434475db
Add InstantDataRepository
22 lines
603 B
SQL
22 lines
603 B
SQL
create database postgres;
|
|
create schema public;
|
|
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
|
SELECT timescaledb_pre_restore();
|
|
|
|
\! pg_restore -Fc -d postgres dump_2022-01-11.bak
|
|
|
|
SELECT timescaledb_post_restore();
|
|
|
|
--https://www.postgresql.org/docs/current/rules-materializedviews.html
|
|
|
|
CREATE MATERIALIZED VIEW mv_telemetry_statistic AS select
|
|
id_telemetry,
|
|
count(*) as count,
|
|
min(date) as date_start,
|
|
max(date) as date_end,
|
|
min(well_depth) as depth_start,
|
|
max(well_depth) as depth_end
|
|
from t_telemetry_data_saub
|
|
group by id_telemetry;
|
|
|
|
select * from t_telemetry_message ttm where id_event = 206; |