-
Notifications
You must be signed in to change notification settings - Fork 0
Review gist of CrateDB adapter #63
Copy link
Copy link
Open
Description
Hi there,
we just talked about TSPERF again, because both TSBS and RockBench will no longer be maintained going forward, so TSPERF could be considered as a good alternative.
Can I humbly ask you to evaluate and/or confirm this is the optimal / most-performant way to insert data into CrateDB?
tsperf/tsperf/adapter/cratedb.py
Lines 66 to 79 in 666ddfe
| # Create table. | |
| stmt = f"""CREATE TABLE {self.table_name} ("ts" TIMESTAMP WITH TIME ZONE, | |
| "g_ts_{self.partition}" TIMESTAMP WITH TIME ZONE GENERATED ALWAYS AS date_trunc('{self.partition}', "ts"), | |
| "payload" OBJECT(DYNAMIC)) | |
| CLUSTERED INTO {self.shards} SHARDS | |
| PARTITIONED BY ("g_ts_{self.partition}") | |
| WITH (number_of_replicas = {self.replicas})""" | |
| logger.info(f"Preparing database with statement:\n{stmt}") | |
| self.cursor.execute(stmt) | |
| @timed_function() | |
| def insert_stmt(self, timestamps: list, batch: list): | |
| stmt = f"""INSERT INTO {self.table_name} (ts, payload) (SELECT col1, col2 FROM UNNEST(?,?))""" # noqa: S608 | |
| self.cursor.execute(stmt, (timestamps, batch)) |
With kind regards,
Andreas.
/cc @WalBeh, @proddata, @hammerhead, @hlcianfagna
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels