S
S
stanik2017-12-17 18:28:07
MySQL
stanik, 2017-12-17 18:28:07

How to organize the storage of currency quotes in the database?

Hello! Now the task is to collect data on the quotes of a certain currency every second (let there be bitcoin). Based on these data, it will be necessary to build graphs of changes for the last hour/day/week/month, etc.
How to store the received data? At the moment I see a table with fields datetime for the timestamp and rate for the value. The question is, will MySQL pull such a load if there are, for example, 1000 such currencies? That is, a thousand new records will be added every second. Or are there more specific/rational solutions for such purposes? If so, please kick in which direction to dig. Thank you!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Melkij, 2017-12-17
@melkij

https://en.wikipedia.org/wiki/Time_series_database
Mysql can write 1000 rows per second. Reading a monthly chart (2.5 million points for a quote alone) can be quite expensive

D
Dimonchik, 2017-12-17
@dimonchik2013

cm.

A
Alex-1917, 2017-12-17
@alex-1917

Write down the delta , if the delta is zero, then don’t write at all, I saved 30% of the space occupied by the database and, accordingly, the required processing speed, when outputting, the query is just a little more complicated!
Well, if with regards to your parameters, which = 1000:
Another problem of premature optimization)))
You will not have 1000 currencies!
And you will not have 1000 updates per second!
Your parameters are similar to a typical average Korean stock exchange, of which there are under two hundred, but there are no more than 70 currencies and a lard turnover per month , how many per second xs, do you have exactly the same project ?? and you ask HERE??)))!

R
Roman Mirilaczvili, 2017-12-18
@2ord

Round Robin Database: RRDtool.
They effectively store the aggregation of metrics over time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question