optimize log lookup

This commit is contained in:
Brokkonaut
2018-11-02 03:33:38 +01:00
parent fde6927aeb
commit 40531988b0

View File

@ -122,6 +122,14 @@ public final class QueryParams implements Cloneable {
} }
String from = "FROM `" + getTable() + "-blocks` "; String from = "FROM `" + getTable() + "-blocks` ";
// heuristics - for a small radius using coords index is much faster, but mysql sometimes does not use it
if ((loc != null && radius <= 500) || (sel != null && sel.getSizeX() <= 1000)) {
if (since < 0 || since > 11000) {
from += "USE INDEX (coords) ";
}
}
if (needPlayer || players.size() > 0) { if (needPlayer || players.size() > 0) {
from += "INNER JOIN `lb-players` USING (playerid) "; from += "INNER JOIN `lb-players` USING (playerid) ";
} }