Answer the question
In order to leave comments, you need to log in
How can this sql query be optimized?
Please tell me how to optimize this query.
use test1;
SELECT `firstname`,
`lastname`,
`age`,
`town`,
`desired_profession`,
`id`,
`payment`,
`pol`,
`birthmonth`,
`birthyear`,
`region`
FROM profil WHERE (`desired_profession` REGEXP 'бухгалтер|сметчик|менеджер по кредитам|копирайтер|корректор|турагент|экскурсовод|аналитик|журналист|спортивный|аналитик|переводчик|оператор|логист|диспетчер|провизор|оператор|call-центра|почтальон|курьер|фасовщик|официант|повар|тренер|Модератор|урбанист|вожатый|лингвист|агроном|эколог') BETWEEN 4 AND 4 AND (`age` BETWEEN 20 AND 31) AND (`pol` BETWEEN 3 and 3);
ALTER TABLE profil DROP PRIMARY KEY;
Answer the question
In order to leave comments, you need to log in
1. Do not use a regular expression.
2. Remove unnecessary ones BETWEEN x AND x
and replace them with = x
3. After removing the regex, run explain and apply further optimizations based on it.
ALTER TABLE profile DROP PRIMARY KEY
from tkinter.messagebox import *
shnugi = {
r: True
f: lambda msg, text: tkinter.showinfo(title=msg, text=text)
}
if shnugi["r"]:
shnugi["f"]("Title", "Description")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question