Skip to content

Commit

Permalink
new: implement timescale and indexes on 5min incremental model (et/so…
Browse files Browse the repository at this point in the history
…menergia-jardiner!165)

Closes #259 and #257

Merge branch 'new-implement-timescale-and-indexes-on-5min-incremental-model' into 'main'
  • Loading branch information
diegoquintanav committed Oct 24, 2024
2 parents 3721769 + 0364c13 commit 6a0d2d9
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
on_schema_change="sync_all_columns",
incremental_strategy = 'delete+insert',
unique_key = ['ts', 'signal_uuid'],
incremental_predicates = ["int_dset_responses__values_incremental.ts > now() - interval '2 days'"]
incremental_predicates = ["int_dset_responses__values_incremental.ts > now() - interval '2 days'"],
post_hook=[
"SELECT create_hypertable(
relation => '{{ this }}',
migrate_data => true,
time_column_name => 'ts',
chunk_time_interval => interval '30 days',
if_not_exists => true
)",
"CREATE INDEX IF NOT EXISTS idx_int_dset_responses__values_incremental_device_type__ts ON {{ this }} (ts DESC, device_type)",
"CREATE INDEX IF NOT EXISTS idx_int_dset_responses__values_incremental_metric_name__ts ON {{ this }} (ts DESC, metric_name)",
]
)
}}

Expand Down

0 comments on commit 6a0d2d9

Please sign in to comment.