A
A
Alexander Bulatov2020-06-05 13:38:50
SQL
Alexander Bulatov, 2020-06-05 13:38:50

Is there some technology how to optimize database queries?

Good day!

Perhaps there is an answer somewhere, but I did not find it.

Situation: I used the Explain command, but even after adding keys and queries for these keys, it still turns out that a huge number of lines are affected.

The question is exactly this: is there a technology for optimizing database queries at all, or is it a direct art given to the Gods?

I would be grateful for just a link or point to books. In general, I will be very grateful for any help in this matter.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2020-06-05
@alexanderbulatov

but even after adding keys and queries on these keys, it still turns out that a huge number of rows are affected

This explain still needs to be learned to read.
Here is a good article to start with, take a special look at the type column
https://mattweb.ru/moj-blog/bazy-dannykh/item/65-i...
Then try to build such indexes to reduce type to the best option.
At the same time, do not forget that a large number of indexes slows down the insertion (and takes up disk space, but this is rather a trifle).

K
Konstantin Tsvetkov, 2020-06-05
@tsklab

Yes. Query optimizer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question