Skip to content

Review gist of CrateDB adapter #63

@amotl

Description

@amotl

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?

# 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions