mirror of https://github.com/apache/druid.git
ArchiveTask list-unused query optimization (#4600)
* ArchiveTask list unused query optimization * ArchiveTask list unused query optimization
This commit is contained in:
parent
684cfbf889
commit
2005c5532f
|
@ -928,10 +928,14 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor
|
|||
@Override
|
||||
public List<DataSegment> inTransaction(final Handle handle, final TransactionStatus status) throws Exception
|
||||
{
|
||||
// 2 range conditions are used on different columns, but not all SQL databases properly optimize it.
|
||||
// Some databases can only use an index on one of the columns. An additional condition provides
|
||||
// explicit knowledge that 'start' cannot be greater than 'end'.
|
||||
return handle
|
||||
.createQuery(
|
||||
StringUtils.format(
|
||||
"SELECT payload FROM %1$s WHERE dataSource = :dataSource and start >= :start and %2$send%2$s <= :end and used = false",
|
||||
"SELECT payload FROM %1$s WHERE dataSource = :dataSource and start >= :start "
|
||||
+ "and start <= :end and %2$send%2$s <= :end and used = false",
|
||||
dbTables.getSegmentsTable(), connector.getQuoteString()
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue