lundi 29 décembre 2014

Select statement optimization in sqlite

How to optimize this select statement :



SELECT string,((string like '%re%') +
(string like '%es%') +
(string like '%se%') +
(string like '%ea%') +
(string like '%ar%') +
(string like '%rc%') +
(string like '%ch%')
) as hits
FROM words
WHERE ((string like '%re%') OR
(string like '%es%') OR
(string like '%se%') OR
(string like '%ea%') OR
(string like '%ar%') OR
(string like '%rc%') OR
(string like '%ch%')
)
ORDER BY hits DESC
LIMIT 3

Aucun commentaire:

Enregistrer un commentaire