Python seems to slow to insert rows into database. I am using timescaleDB and executemany for insert. For testing, I use simply table:
time, seq, symbol, tick
for testing
The sample data can be:
2019-02-05 07:44:59.326+00 1 VGM9 Index Test
So I try:
CREATE TABLE ticks(
time TIMESTAMPTZ NOT NULL,
seq int NOT NULL,
symbol VARCHAR(20) NOT NULL,
tick VARCHAR(20),
PRIMARY KEY (time, seq, symbol)
);
insert_query = "INSERT INTO ticks(time, seq, symbol, tick) VALUES (%s, %s, %s, %s);"
self._cursor.executemany(insert_query, values_list)
It takes me around 17-18s to insert 100,000 rows into local DB
Is there a better way to do this?