mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-20 11:42:50 +02:00
Attempt at improving performance of a query - can not be improved:
The query is slow due to lack of table normalization on plan_user_info
This commit is contained in:
parent
04f426aca1
commit
d9f8d09607
|
@ -170,16 +170,21 @@ public class UserInfoTable extends UserIDTable {
|
|||
}
|
||||
|
||||
public List<UserInfo> getServerUserInfo(UUID serverUUID) throws SQLException {
|
||||
Optional<Integer> serverID = serverTable.getServerID(serverUUID);
|
||||
if (!serverID.isPresent()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Map<UUID, String> playerNames = usersTable.getPlayerNames();
|
||||
Map<Integer, UUID> uuidsByID = usersTable.getUUIDsByID();
|
||||
|
||||
String sql = "SELECT * FROM " + tableName +
|
||||
" WHERE " + Col.SERVER_ID + "=" + serverTable.statementSelectServerID;
|
||||
" WHERE " + Col.SERVER_ID + "=?";
|
||||
|
||||
return query(new QueryStatement<List<UserInfo>>(sql, 20000) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, serverUUID.toString());
|
||||
statement.setInt(1, serverID.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ import com.djrapitops.plan.system.info.server.Server;
|
|||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.processors.player.RegisterProcessor;
|
||||
import com.djrapitops.plan.utilities.Base64Util;
|
||||
import com.djrapitops.plan.utilities.ManageUtils;
|
||||
import com.djrapitops.plan.utilities.SHA256Hash;
|
||||
import com.djrapitops.plan.utilities.analysis.MathUtils;
|
||||
import com.djrapitops.plugin.StaticHolder;
|
||||
|
@ -759,7 +758,7 @@ public class SQLiteTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBackupAndRestore() throws SQLException, DBInitException, UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
public void testBackupAndRestore() throws SQLException, DBException, UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
System.out.println("- Creating Backup Database -");
|
||||
SQLiteDB backup = new SQLiteDB("debug-backup" + System.currentTimeMillis());
|
||||
backup.init();
|
||||
|
@ -767,7 +766,7 @@ public class SQLiteTest {
|
|||
|
||||
saveAllData(db);
|
||||
|
||||
ManageUtils.clearAndCopy(backup, db);
|
||||
db.backup().backup(backup);
|
||||
|
||||
UserInfoTable userInfoTable = backup.getUserInfoTable();
|
||||
UsersTable usersTable = backup.getUsersTable();
|
||||
|
|
Loading…
Reference in New Issue
Block a user