mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 11:08:08 +01:00
Removed redundant left join
This commit is contained in:
parent
e1860cc62c
commit
8928ded103
@ -1,4 +1,4 @@
|
||||
package com.djrapitops.plan.db.patches;
|
||||
package com.djrapitops.plan.db.access.transactions.init;
|
||||
|
||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||
import com.djrapitops.plan.db.sql.tables.UserInfoTable;
|
||||
@ -17,19 +17,15 @@ public class RemoveDuplicateUserInfoTransaction extends Transaction {
|
||||
|
||||
private static final String COLUMN_ID = UserInfoTable.TABLE_NAME + '.' + UserInfoTable.ID;
|
||||
private static final String STATEMENT_SELECT_DUPLICATE_IDS =
|
||||
'(' + SELECT + "MIN(" + COLUMN_ID + ") as id" + FROM + UserInfoTable.TABLE_NAME +
|
||||
GROUP_BY + UserInfoTable.USER_UUID + ", " + UserInfoTable.SERVER_UUID + ')';
|
||||
SELECT + "MIN(" + COLUMN_ID + ") as id" + FROM + UserInfoTable.TABLE_NAME +
|
||||
GROUP_BY + UserInfoTable.USER_UUID + ", " + UserInfoTable.SERVER_UUID;
|
||||
|
||||
@Override
|
||||
protected void performOperations() {
|
||||
execute(
|
||||
"DELETE" + FROM + UserInfoTable.TABLE_NAME +
|
||||
WHERE + COLUMN_ID +
|
||||
" IN (" +
|
||||
SELECT + COLUMN_ID + FROM + UserInfoTable.TABLE_NAME +
|
||||
LEFT_JOIN + STATEMENT_SELECT_DUPLICATE_IDS + " q2 on q2.id=" + COLUMN_ID +
|
||||
WHERE + "q2.id" + IS_NULL +
|
||||
')'
|
||||
" NOT IN (" + STATEMENT_SELECT_DUPLICATE_IDS + ')'
|
||||
);
|
||||
}
|
||||
}
|
@ -21,8 +21,8 @@ import com.djrapitops.plan.db.Database;
|
||||
import com.djrapitops.plan.db.access.Query;
|
||||
import com.djrapitops.plan.db.access.QueryStatement;
|
||||
import com.djrapitops.plan.db.access.transactions.commands.RemovePlayerTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.init.RemoveDuplicateUserInfoTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.init.RemoveOldSampledDataTransaction;
|
||||
import com.djrapitops.plan.db.patches.RemoveDuplicateUserInfoTransaction;
|
||||
import com.djrapitops.plan.db.sql.tables.SessionsTable;
|
||||
import com.djrapitops.plan.extension.implementation.storage.transactions.results.RemoveUnsatisfiedConditionalResultsTransaction;
|
||||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
|
@ -44,8 +44,8 @@ import com.djrapitops.plan.db.access.transactions.commands.*;
|
||||
import com.djrapitops.plan.db.access.transactions.events.*;
|
||||
import com.djrapitops.plan.db.access.transactions.init.CreateIndexTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.init.CreateTablesTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.init.RemoveDuplicateUserInfoTransaction;
|
||||
import com.djrapitops.plan.db.patches.Patch;
|
||||
import com.djrapitops.plan.db.patches.RemoveDuplicateUserInfoTransaction;
|
||||
import com.djrapitops.plan.db.tasks.DBCleanTask;
|
||||
import com.djrapitops.plan.extension.CallEvents;
|
||||
import com.djrapitops.plan.extension.DataExtension;
|
||||
|
Loading…
Reference in New Issue
Block a user