M
M
maksam072019-04-16 23:12:42
MySQL
maksam07, 2019-04-16 23:12:42

How to implement fast data update in mysql?

There is a database of disposable goods, for the test I loaded about a million units of goods there. And here UPDATE in this table lasts 3 seconds. The first SELECT after an UPDATE also lasts 3 seconds (then cached until the next UPDATE).
I rarely use SELECT, but I have to use UPDATE often, so the question is, how are databases optimized? I don't think that a million lines is a lot, but I'm sure that all this should obviously not work for 3 seconds. What data do you need to provide or do you have any general advice on compiling a database?

UPDATE and SELECT
5cb637229c4ba813111858.png
SELECT only (cached)
5cb637d66ff80367591206.png
timer - request execution time

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2019-04-16
@maksam07

Databases are optimized by creating the right indexes and building queries that use those indexes.

R
Roman Mirilaczvili, 2019-04-17
@2ord

You can delete the index before updating the data, then recreate it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question