forked from LogBlock/LogBlock
optimize log lookup
This commit is contained in:
@ -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) ";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user