A
A
Alexander Korolev2016-08-16 13:35:09
Ruby on Rails
Alexander Korolev, 2016-08-16 13:35:09

How to correctly change the value of a field in a database table with a large number of queries?

I have a " poll " model that contains the text of the poll and two counters: the number of votes for and the number of votes against .
It seems that everything is simple: the client takes the text of the survey and then returns the answer, and therefore we increment one of the counters. But wouldn't it be a problem if there are many answers at the same time?
Maybe it's better to make a separate plate of answers, or is there an even more rational way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)

You can write views to Redis to take the load off the database. And periodically transfer the recorded number from redis to the database

A
Alexander Skusnov, 2016-08-16
@AlexSku

We had an ordinary Firebird and coped with a bang. Only it is necessary to use stored procedures. Specifically, a timestamp was put down (in debug mode) for messages coming and going on the CAN bus. The time for the message itself is 1 ms. So, almost all outgoing messages had the same time as the received ones (with an intermediate database access).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question