diff --git a/.unreleased/pr_7148 b/.unreleased/pr_7148 new file mode 100644 index 00000000000..3ac48c07c71 --- /dev/null +++ b/.unreleased/pr_7148 @@ -0,0 +1 @@ +Implements: #7148 Order chunks for compression by range_start diff --git a/sql/policy_internal.sql b/sql/policy_internal.sql index 28b97120c47..320c23789bf 100644 --- a/sql/policy_internal.sql +++ b/sql/policy_internal.sql @@ -94,6 +94,9 @@ BEGIN INNER JOIN pg_class pgc ON pgc.oid = show.oid INNER JOIN pg_namespace pgns ON pgc.relnamespace = pgns.oid INNER JOIN _timescaledb_catalog.chunk ch ON ch.table_name = pgc.relname AND ch.schema_name = pgns.nspname AND ch.hypertable_id = htid + INNER JOIN _timescaledb_catalog.chunk_constraint cc ON ch.id = cc.chunk_id + INNER JOIN _timescaledb_catalog.dimension d ON d.hypertable_id = ch.hypertable_id + INNER JOIN _timescaledb_catalog.dimension_slice ds ON d.id = ds.dimension_id AND cc.dimension_slice_id = ds.id WHERE NOT ch.dropped AND NOT ch.osm_chunk AND ( @@ -105,6 +108,7 @@ BEGIN ) ) ) + ORDER BY ds.range_start LOOP IF chunk_rec.status = 0 THEN BEGIN