C
C
Constantine2015-11-12 21:58:59
MySQL
Constantine, 2015-11-12 21:58:59

At what number of records is it better to use a transaction?

I just started learning about databases, so sorry for the noob question.
There is a method insertData(data) where data is the data of which can be 1 ≤ data.lenght ≤ 10 000.
Question: At what number of records is it better to start using a transaction?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SwoDs, 2015-11-12
@SwoDs

Transactions are used when executing related queries, regardless of the number.
For example, one person transfers money to another, these are two requests:
Withdraw 10 rubles from Vasya.
Top up Petya's balance by 10 rubles.
If an error occurs at the 2nd request and the transaction is not used, then Vasya's money will be lost, and Petya's will not appear.
When using a transaction, all changes are rolled back.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question