Alex Velickiy
Alex Velickiy

Reputation: 571

Which DB and what Indexes best suit for the case?

I need to create a DB which will store trades data for different exchanges. The table columns are 'exchange name', 'timestamp' and 'data' (JSON string). The only query I would need is 'get data for one or many exchanges with timestamp in defined range.

I don't think that amount of data will ever by more than 1GB and I'll keep DB locally on my laptop.

What would be best choice (in terms of speed) DB option: MySQL, PostgreSQL or SQLite? What indexes should I create?

Upvotes: 0

Views: 53

Answers (2)

Rick James
Rick James

Reputation: 142503

Use any RDBMS.

Use IN, not OR.

Have

INDEX(timestamp),
INDEX(exchange, timestamp)

Upvotes: 0

CL.
CL.

Reputation: 180210

With 1 GB, there will be no noticeable speed difference. But with a self-contained laptop application, you do not need a client/server systen, so you should probably use an embedded database with less administration overhead.

You should create an index on the lookup column that has the highest selectivity in your queries, i.e., on the timestamp column. If there are enough different exchanges, it might make sense to include the exchange column in that index.

Upvotes: 1

Related Questions