Skip to content

Add --use-columnstore to the TimescaleDB loader, and fix loading on TimescaleDB >= 2.14 - #298

Merged
mattstratton merged 3 commits into
masterfrom
timescaledb-columnstore
Nov 17, 2026
Merged

mattstratton merged 3 commits into
masterfrom
timescaledb-columnstore

Conversation

@mattstratton

@mattstratton mattstratton commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Two changes to the TimescaleDB target.

1. create_hypertable no longer gets replication_factor

create_hypertable lost its replication_factor parameter when multi-node was removed in TimescaleDB 2.14. The loader passed replication_factor => NULL for every plain hypertable, so tsbs_load_timescaledb fails on every current release. It now passes no partitioning arguments unless --partitions or --replication-factor is set.

2. --use-columnstore

TSBS had no way to load into the columnstore (hypercore), so every TimescaleDB result it produced measured uncompressed rowstore chunks.

flag default
--use-columnstore false convert every chunk once the load finishes, then ANALYZE
--columnstore-segmentby tags_id timescaledb.segmentby
--columnstore-orderby time DESC timescaledb.orderby
  • Off by default, so existing behaviour is unchanged.
  • The conversion runs from a new optional DBCreatorPostLoad hook, called after the load has been timed and reported. It does not count towards the ingest rate. The loader logs the conversion time as a separate line, so both can be reported.
  • Requires TimescaleDB >= 2.18; older versions get a clear error.
  • Only the tables the load wrote to are converted.
  • Works from both tsbs_load_timescaledb and tsbs_load load timescaledb.

Testing

Unit tests cover the generated SQL, the version gate, the flag validation, table scoping and the loader hook.

Run end to end against TimescaleDB 2.31.0 on PostgreSQL 17.11 (cpu-only and iot, scale 50, 2 days):

  • Flag off: chunks stay uncompressed, as before.
  • --use-columnstore: all chunks converted, row count unchanged, database 168 MB → 18 MB, queries run against the result.
  • iot: both hypertables (readings, diagnostics) converted; a custom --columnstore-orderby is applied.
  • Another hypertable already in the same database is left alone.
  • --use-columnstore --use-hypertable=false fails before the load starts.
  • Same behaviour through tsbs_load load timescaledb with a config file.

🤖 Generated with Claude Code

mattstratton and others added 2 commits November 11, 2026 09:58
create_hypertable lost its replication_factor parameter when multi-node
was removed in TimescaleDB 2.14. The loader passed
"replication_factor => NULL" on every plain hypertable, so
tsbs_load_timescaledb fails on every current TimescaleDB release.

Pass no partitioning arguments unless --partitions or
--replication-factor is set.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
TSBS had no way to load into the TimescaleDB columnstore (hypercore), so
every TimescaleDB result it produced measured uncompressed rowstore
chunks, which is not how TimescaleDB is deployed.

--use-columnstore converts every chunk to the columnstore once the load
finishes, then runs ANALYZE. --columnstore-segmentby (default tags_id)
and --columnstore-orderby (default "time DESC") set the layout. The
flag is off by default, so existing behaviour is unchanged.

The conversion runs from a new optional DBCreatorPostLoad hook that the
loader calls after the load has been timed and reported, so it does not
count towards the ingest rate. Requires TimescaleDB >= 2.18.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The conversion runs after the timed load, so the reported ingest rate
covers rowstore ingest only. Log the conversion time as its own line so
the full cost of getting to compressed data can be reported alongside it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mattstratton
mattstratton merged commit c08b6b9 into master Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants