on 05-24-2019 1:01 PM
Hi , Just wanted to know whether we can add indexes to the table/type during the run time by java code ?
As an example, we have some issue with the cron job which is taking longer time due to some database performance. We just now wanted to add the indexes to the sample addresses table/type just before the flexible search query we are going to execute on this table.
We also wanted to remove the indexes as soon as the flexible search query is run or as soon as the cron job gets completed.
Hi - In Hybris, all DDL statements should be executed as part of Init/Update. Please also note that Update does not delete any database objects (tables, indexes, columns etc.). You should define the index in items.xml
and perform Update.
Nevertheless, you can try the following groovy code to create the database index:
import de.hybris.platform.core.Registry
conn = Registry.getCurrentTenant().getDataSource().getConnection()
stmt = conn.createStatement()
ddlQuery = "YOUR CREATE INDEX SQL COMMAND"
stmt.executeUpdate(ddlQuery)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.