Skip to content

Commit

Permalink
Fix: view watermark is in the future (#109)
Browse files Browse the repository at this point in the history
* Fix: view watermark is in the future

* Fix: all views
  • Loading branch information
aopoltorzhicky authored Jan 28, 2024
1 parent 3e65bd3 commit e96a866
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 27 deletions.
5 changes: 3 additions & 2 deletions database/views/00_block_stats_by_minute.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
(case when sum(gas_limit) > 0 then sum(gas_used) / sum(gas_limit) else 0 end) as gas_efficiency
from block_stats
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('block_stats_by_minute', INTERVAL '1 minute', INTERVAL '1 minute');
CALL add_view_refresh_job('block_stats_by_minute', NULL, INTERVAL '1 minute');
5 changes: 3 additions & 2 deletions database/views/01_block_stats_by_hour.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
(case when sum(gas_limit) > 0 then sum(gas_used) / sum(gas_limit) else 0 end) as gas_efficiency
from block_stats_by_minute as bbm
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('block_stats_by_hour', INTERVAL '1 minute', INTERVAL '15 minute');
CALL add_view_refresh_job('block_stats_by_hour', NULL, INTERVAL '1 minute');
5 changes: 3 additions & 2 deletions database/views/02_block_stats_by_day.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
(case when sum(gas_limit) > 0 then sum(gas_used) / sum(gas_limit) else 0 end) as gas_efficiency
from block_stats_by_hour as hour
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('block_stats_by_day', INTERVAL '1 minute', INTERVAL '1 hour');
CALL add_view_refresh_job('block_stats_by_day', NULL, INTERVAL '5 minute');
3 changes: 2 additions & 1 deletion database/views/03_block_stats_by_year.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
(case when sum(gas_limit) > 0 then sum(gas_used) / sum(gas_limit) else 0 end) as gas_efficiency
from block_stats_by_day as day
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('block_stats_by_year', NULL, INTERVAL '1 hour');
3 changes: 2 additions & 1 deletion database/views/04_block_stats_by_month.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
(case when sum(gas_limit) > 0 then sum(gas_used) / sum(gas_limit) else 0 end) as gas_efficiency
from block_stats_by_day as day
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('block_stats_by_month', NULL, INTERVAL '1 hour');
5 changes: 3 additions & 2 deletions database/views/05_block_stats_by_week.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
(case when sum(gas_limit) > 0 then sum(gas_used) / sum(gas_limit) else 0 end) as gas_efficiency
from block_stats_by_day as day
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('block_stats_by_week', INTERVAL '1 minute', INTERVAL '1 hour');
CALL add_view_refresh_job('block_stats_by_week', NULL, INTERVAL '1 hour');
5 changes: 3 additions & 2 deletions database/views/06_namespace_stats_by_hour.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
sum(size) as size
from namespace_message as nm
group by 1, 2
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('namespace_stats_by_hour', INTERVAL '1 minute', INTERVAL '15 minutes');
CALL add_view_refresh_job('namespace_stats_by_hour', NULL, INTERVAL '1 minutes');
5 changes: 3 additions & 2 deletions database/views/07_namespace_stats_by_day.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
sum(size) as size
from namespace_stats_by_hour as nm
group by 1, 2
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('namespace_stats_by_day', INTERVAL '1 minute', INTERVAL '1 hour');
CALL add_view_refresh_job('namespace_stats_by_day', NULL, INTERVAL '5 minute');
3 changes: 2 additions & 1 deletion database/views/08_namespace_stats_by_year.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
sum(size) as size
from namespace_stats_by_day as nm
group by 1, 2
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('namespace_stats_by_year', NULL, INTERVAL '1 hour');
3 changes: 2 additions & 1 deletion database/views/09_namespace_stats_by_month.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS namespace_stats_by_month
sum(size) as size
from namespace_stats_by_day as nm
group by 1, 2
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('namespace_stats_by_month', NULL, INTERVAL '1 hour');
5 changes: 3 additions & 2 deletions database/views/10_namespace_stats_by_week.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
sum(size) as size
from namespace_stats_by_day as nm
group by 1, 2
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('namespace_stats_by_week', INTERVAL '1 minute', INTERVAL '1 hour');
CALL add_view_refresh_job('namespace_stats_by_week', NULL, INTERVAL '1 hour');
5 changes: 3 additions & 2 deletions database/views/11_rollup_stats_by_hour.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
count(*) as blobs_count,
max(logs.time) as last_time
from blob_log as logs
group by 1, 2, 3;
group by 1, 2, 3
with no data;

CALL add_view_refresh_job('rollup_stats_by_hour', INTERVAL '1 minute', INTERVAL '10 minute');
CALL add_view_refresh_job('rollup_stats_by_hour', NULL, INTERVAL '1 minute');
5 changes: 3 additions & 2 deletions database/views/12_rollup_stats_by_day.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
sum(logs.blobs_count) as blobs_count,
max(logs.last_time) as last_time
from rollup_stats_by_hour as logs
group by 1, 2, 3;
group by 1, 2, 3
with no data;

CALL add_view_refresh_job('rollup_stats_by_day', INTERVAL '1 minute', INTERVAL '1 hour');
CALL add_view_refresh_job('rollup_stats_by_day', NULL, INTERVAL '5 minute');
3 changes: 2 additions & 1 deletion database/views/13_rollup_stats_by_month.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
sum(logs.blobs_count) as blobs_count,
max(logs.last_time) as last_time
from rollup_stats_by_day as logs
group by 1, 2, 3;
group by 1, 2, 3
with no data;

CALL add_view_refresh_job('rollup_stats_by_month', NULL, INTERVAL '1 hour');
5 changes: 3 additions & 2 deletions database/views/14_price_by_hour.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
last(price.close, price.time) as close
from price
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('price_by_hour', INTERVAL '1 minute', INTERVAL '10 minute');
CALL add_view_refresh_job('price_by_hour', NULL, INTERVAL '1 minute');
5 changes: 3 additions & 2 deletions database/views/15_price_by_day.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=false) AS
last(price.close, price.time) as close
from price_by_hour as price
group by 1
order by 1 desc;
order by 1 desc
with no data;

CALL add_view_refresh_job('price_by_day', INTERVAL '1 minute', INTERVAL '10 minute');
CALL add_view_refresh_job('price_by_day', NULL, INTERVAL '5 minute');

0 comments on commit e96a866

Please sign in to comment.