Repository navigation
Conversation
Create each hypertable with a single CREATE TABLE ... WITH (tsdb.hypertable, ...) statement and, by default, enable the columnstore with tsdb.direct_compress, so COPY and INSERT write compressed batches during the timed load. This replaces the post-load conversion, so the DBCreatorPostLoad hook and the loader changes that called it are removed again. - --use-columnstore now defaults to true; it is ignored for plain tables (--use-hypertable=false) instead of being an error - new --columnstore-direct-compress (default true, needs TimescaleDB >= 2.29); with false, chunks are left to the columnstore policy - new --columnstore-sparse-index to set tsdb.sparse_index - rowstore hypertables pass tsdb.columnstore = false, since CREATE TABLE ... WITH enables the columnstore by default - --partitions uses add_dimension(by_hash(...)) - --replication-factor >= 1 fails early: multi-node was removed in 2.14 - the TimescaleDB version is checked before any table is created Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Discussed internally that the approach does not suit the broader set of scenarios we want to cover |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #298: the diff here is only the change on top of it, and it should merge after #298. It replaces #298's post-load conversion with direct compress, so the columnstore is the default layout for the TimescaleDB target.
What changes
One
CREATE TABLEper hypertable. Tables are created withCREATE TABLE ... WITH (tsdb.hypertable, tsdb.partition_column = 'time', tsdb.chunk_interval, tsdb.create_default_indexes = false, ...)instead ofcreate_hypertable.Direct compress instead of a post-load conversion. With the columnstore on, the table also gets
tsdb.segmentby,tsdb.orderbyandtsdb.direct_compress, soCOPYandINSERTwrite compressed batches during the timed load. Nothing runs after the load, so theDBCreatorPostLoadhook from #298 is removed andload/andpkg/targets/creator.goare back to what's on master.Defaults
--use-columnstoretrue--use-hypertable=false--columnstore-direct-compresstrue(new)--columnstore-segmentbytags_id--columnstore-orderbytime DESC--columnstore-sparse-indextsdb.sparse_index; empty lets TimescaleDB chooseOther changes:
--use-columnstore=false) passtsdb.columnstore = false, becauseCREATE TABLE ... WITHturns the columnstore on by default.--columnstore-direct-compress=falseenables the columnstore but leaves chunks uncompressed until TimescaleDB's columnstore policy converts them.--partitionsusesadd_dimension(by_hash(...)).--replication-factor >= 1fails before loading, because multi-node was removed in 2.14.scripts/load/load_timescaledb.shgainsUSE_COLUMNSTOREandCOLUMNSTORE_DIRECT_COMPRESSenv vars.Behaviour change
--columnstore-direct-compress=false(needs 2.20+) or--use-columnstore=false. Master doesn't load on 2.14 or later at all.Benchmark
cpu-only, scale 200, 3 days (5.18M rows), 8 load workers, default batch size of 10,000. Each config ran twice; the table shows the better pass.
VACUUM ANALYZEandCHECKPOINTran after each load. Each query type is 100 queries on 4 workers, median latency. Local Docker on an 11-core Mac, TimescaleDB 2.32.0 / PG 17.11. Master fails on 2.32, so it ran on 2.13.1 / PG 16.1 ¹.¹ TimescaleDB 2.13.1 / PG 16.1. ²
--columnstore-sparse-indexwithfirstlastontime, all 10 metrics andadditional_tags.The two passes differed by up to 25%, so treat differences under about 20% as noise.
COPY: a 10,000-row batch over 200 hosts gives about 50 rows per segment.--batch-size=200000brought it to 57 MB in a separate run, at slower ingest (18 s). The compaction policy TimescaleDB creates didn't merge the small batches.groupby-orderby-limitis slower on the columnstore: the newest rows have to be found across 200 segments.firstlaston every column bringslastpointback to rowstore speed by answering from batch metadata (Metadata Only: true), for about 19% more storage.minmax(usage_user)prunes 87% of batches inhigh-cpu-allbut only gains about 10%. Without a segmentby,bloom(tags_id)can't replace it, because every batch contains all hosts.Notes for reviewers
firstlastsparse indexes aren't configurable, but 2.32 accepts them on any column.go testforpkg/targets/timescaledbdoesn't build under Go 1.26 because of an existing vet error atfile_data_source.go:60, which is also on master. The tests pass with-vet=off.Testing
CREATE TABLEfor each mode, the flag defaults (read through viper astsbs_loaddoes), validation and the version requirement.tags_id--columnstore-direct-compress=falseleaves chunks uncompressed under a columnstore policy--use-columnstore=falsegives a rowstore hypertable--use-hypertable=falsegives a plain table--partitionscreates two dimensions--columnstore-sparse-indexis appliediotgets both hypertables compressed--replication-factor=1fails earlytsbs_load load timescaledbwith an unmodified sample config gets the new defaults🤖 Generated with Claude Code