-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8ff884
commit 03ab9a5
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...ain/java/com/dotmarketing/startup/runonce/Task231207AddInodeAndIdentifierLeftIndexes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.dotmarketing.startup.runonce; | ||
|
||
import com.dotmarketing.common.db.DotConnect; | ||
import com.dotmarketing.exception.DotDataException; | ||
import com.dotmarketing.exception.DotRuntimeException; | ||
import com.dotmarketing.startup.StartupTask; | ||
|
||
/** | ||
* This upgrade task adds "left" indexes to on the inode.inode and the identifier.id columns. This | ||
* GREATLY speeds up queries that use `like 'param%'` clauses in their queries, where we only wildcard | ||
* on the right hand side. | ||
*/ | ||
public class Task231207AddInodeAndIdentifierLeftIndexes implements StartupTask { | ||
|
||
@Override | ||
public boolean forceRun() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void executeUpgrade() throws DotDataException, DotRuntimeException { | ||
new DotConnect().setSQL("CREATE INDEX if not exists inode_inode_leading_idx ON inode(inode COLLATE \"C\");").loadResult(); | ||
|
||
new DotConnect().setSQL("CREATE INDEX if not exists identifier_id_leading_idx ON identifier(id COLLATE \"C\");").loadResult(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters