Skip to content

Reorder policies

You can add a reorder policy to reorder chunks on a given (virtual) hypertable index in the background.

Info

Consult the Timescale docs to learn more about reorder policies.

Note

You can only create 1 reorder policy per hypertable.

Usage

models/my_hypertable.sql
{{
  config(
    materialized='hypertable',
    main_dimension='time_column',
    reorder_policy={
      index: {
        columns: ['column_a']
      }
    }
  )
}}
select
    current_timestamp as time_column,
    1 as column_a
dbt_project.yml
models:
  your_project_name:
    folder_containing_the_hypertables:
      +materialized: hypertable
        model_one:
          +main_dimension: time_column
          +reorder_policy:
            index:
              columns: ['column_a']
# ...

Configuration options

  • index (required): The configuration for the index to reorder on. See dbt Postgres docs for more information regarding how indexes can be configured.
  • create_index: true by default. A boolean value to indicate if the index specified in index should be created or if it already exists. Either way, an existing index on exactly the columns in index, in that order, is reused.