Suppose I have a table of scores that I precomputed based on some data elsewhere. I want to be able to search this data multiple times per second to get the top x results. The search will weight the scores, and the weights will change constantly. What can I do to speed up this query? I made an example that is a good representation of how I'll be doing things, minus foreign keys to another table, more data, and some other (I hope) inconsequential stuff.
USE clashroyale;
DROP TABLE if exists stackoverflowExample;
CREATE TABLE stackoverflowExample(id int AUTO_INCREMENT, score1 float, score2 float, score3 float, PRIMARY KEY(id));
INSERT INTO stackoverflowExample (score1, score2, score3) VALUES(2,1,-1), (1.12,4.2,3.2);
SELECT *, 0.6*score1+0.3*score2+0.1*score3 as weightedScore FROM stackoverflowExample ORDER BY weightedScore DESC LIMIT 10;
I don't think indexing would work, because no row can be ruled out until it is fully processed so every row must be processed.