diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java index 0fb6d953ac..bf01667131 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java @@ -119,8 +119,11 @@ public class PropertySQLProvider implements SQLProvider { } @Override - public String getCreateFileTableSQL() { - return format(sql("create-file-table"), tableName); + public String[] getCreateFileTableSQL() { + return new String[] { + format(sql("create-file-table"), tableName), + format(sql("create-file-index"), tableName) + }; } @Override diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/SQLProvider.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/SQLProvider.java index 17d03dc44c..ad7640f78a 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/SQLProvider.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/SQLProvider.java @@ -36,7 +36,7 @@ public interface SQLProvider { String getTableName(); - String getCreateFileTableSQL(); + String[] getCreateFileTableSQL(); String getInsertFileSQL(); diff --git a/artemis-jdbc-store/src/main/resources/journal-sql.properties b/artemis-jdbc-store/src/main/resources/journal-sql.properties index 5125554f9f..fe0b113e7d 100644 --- a/artemis-jdbc-store/src/main/resources/journal-sql.properties +++ b/artemis-jdbc-store/src/main/resources/journal-sql.properties @@ -18,9 +18,10 @@ # Generic SQL statements create-file-table=CREATE TABLE %s (ID BIGINT AUTO_INCREMENT, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID)) +create-file-index=CREATE INDEX %1$s_IDX ON %1$s (fileName) insert-file=INSERT INTO %s (FILENAME, EXTENSION, DATA) VALUES (?,?,?) select-filenames-by-extension=SELECT FILENAME, ID FROM %s WHERE EXTENSION=? -select-file-by-filename=SELECT ID, FILENAME, EXTENSION, DATA FROM %s WHERE fileName=? +select-file-by-filename=SELECT ID, FILENAME, EXTENSION FROM %s WHERE fileName=? append-to-file=SELECT DATA FROM %s WHERE ID=? FOR UPDATE read-large-object=SELECT DATA FROM %s WHERE ID=? delete-file=DELETE FROM %s WHERE ID=? @@ -109,4 +110,4 @@ create-journal-table.mssql=CREATE TABLE %s(id BIGINT,recordType SMALLINT,compact create-node-manager-store-table.mssql=CREATE TABLE %s (ID INT NOT NULL, HOLDER_ID VARCHAR(128), HOLDER_EXPIRATION_TIME BIGINT, NODE_ID CHAR(36),STATE CHAR(1), PRIMARY KEY(ID)) current-timestamp.mssql=SELECT SYSUTCDATETIME() current-timestamp-timezone-id.mssql=UTC -max-blob-size.mssql=2147483647 \ No newline at end of file +max-blob-size.mssql=2147483647