mirror of https://github.com/apache/druid.git
Add metadata indexes to help with segment allocation. (#6348)
Segment allocation queries can take a long time (10s of seconds) when you have a lot of segments. Adding these indexes helps greatly.
This commit is contained in:
parent
8972244c68
commit
e1c649e906
|
@ -23,11 +23,11 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.RetryUtils;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
import org.apache.druid.java.util.common.logger.Logger;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.skife.jdbi.v2.Batch;
|
||||
import org.skife.jdbi.v2.DBI;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
|
@ -215,6 +215,11 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector
|
|||
+ " UNIQUE (sequence_name_prev_id_sha1)\n"
|
||||
+ ")",
|
||||
tableName, getPayloadType(), getQuoteString()
|
||||
),
|
||||
StringUtils.format(
|
||||
"CREATE INDEX idx_%1$s_datasource_used_end ON %1$s(dataSource, used, %2$send%2$s)",
|
||||
tableName,
|
||||
getQuoteString()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -259,8 +264,15 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector
|
|||
+ ")",
|
||||
tableName, getPayloadType(), getQuoteString()
|
||||
),
|
||||
StringUtils.format("CREATE INDEX idx_%1$s_datasource ON %1$s(dataSource)", tableName),
|
||||
StringUtils.format("CREATE INDEX idx_%1$s_used ON %1$s(used)", tableName)
|
||||
StringUtils.format(
|
||||
"CREATE INDEX idx_%1$s_datasource_end ON %1$s(dataSource, %2$send%2$s)",
|
||||
tableName,
|
||||
getQuoteString()
|
||||
),
|
||||
StringUtils.format(
|
||||
"CREATE INDEX idx_%1$s_datasource_sequence ON %1$s(dataSource, sequence_name)",
|
||||
tableName
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue