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)

* new: add indexes on high selectivity columns

trying things out to see if things go faster

* chore: format post_hook as an array to allow more tasks after it

* new: add timescale to incremental table with time interval of 30 days
  • Loading branch information
diegoquintanav committed Oct 24, 2024
1 parent 3721769 commit 0364c13
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 0364c13

Please sign in to comment.