Class MVSecondaryIndex
- All Implemented Interfaces:
HasSQL
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classA cursor.private static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TransactionMap<SearchRow, Value> private final MVTableThe multi-value table.Fields inherited from class Index
columnIds, columns, indexColumns, indexType, table, uniqueColumnColumnFields inherited from class DbObject
AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USERFields inherited from interface HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS -
Constructor Summary
ConstructorsConstructorDescriptionMVSecondaryIndex(Database db, MVTable table, int id, String indexName, IndexColumn[] columns, int uniqueColumnCount, IndexType indexType) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(SessionLocal session, Row row) Add a row to the index.voidaddBufferedRows(List<String> bufferNames) Add all the index data from the buffers to the index.voidaddRowsToBuffer(List<Row> rows, String bufferName) Add the rows to a temporary storage (not to the index yet).booleanCheck if the index can get the next higher value.booleanCheck if the index can directly look up the lowest or highest value of a column.private voidcheckUnique(boolean repeatableRead, TransactionMap<SearchRow, Value> map, SearchRow row, long newKey) voidclose(SessionLocal session) Close this index.private SearchRowconvertToKey(SearchRow r, Boolean minMax) private Cursorfind(SessionLocal session, SearchRow first, boolean bigger, SearchRow last) find(SessionLocal session, SearchRow first, SearchRow last) Find a row or a list of rows and create a cursor to iterate over the result.findFirstOrLast(SessionLocal session, boolean first) Find the first (or last) value of this index.findNext(SessionLocal session, SearchRow higherThan, SearchRow last) Find a row or a list of rows that is larger and create a cursor to iterate over the result.doublegetCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet) Estimate the cost to search for rows given the search mask.longGet the used disk space for this index.private TransactionMap<SearchRow, Value> getMap(SessionLocal session) Get the map to store the data.getMVMap()longgetRowCount(SessionLocal session) Get the row count of this table, for the given session.longgetRowCountApproximation(SessionLocal session) Get the approximated row count for this table.getTable()Get the table on which this index is based.booleanCheck if the index needs to be rebuilt.voidremove(SessionLocal session) Remove the index.voidremove(SessionLocal session, Row row) Remove a row from the index.private booleanrowsAreEqual(SearchRow rowOne, SearchRow rowTwo) voidtruncate(SessionLocal session) Remove all rows from the index.voidupdate(SessionLocal session, Row oldRow, Row newRow) Update index after row change.Methods inherited from class Index
canScan, checkIndexColumnTypes, compareRows, getColumnIndex, getColumns, getCostRangeIndex, getCreateSQL, getCreateSQLForCopy, getDuplicateKeyException, getDuplicatePrimaryKeyMessage, getIndexColumns, getIndexType, getPlanSQL, getRow, getRowFactory, getType, getUniqueColumnCount, getUniqueRowFactory, isFindUsingFullTableScan, isFirstColumn, isHidden, isRowIdIndex, mayHaveNullDuplicates, removeChildrenAndResourcesMethods inherited from class SchemaObject
getSchema, getSQL, getSQLMethods inherited from class DbObject
checkRename, getChildren, getComment, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HasSQL
getTraceSQL
-
Field Details
-
mvTable
The multi-value table. -
dataMap
-
-
Constructor Details
-
MVSecondaryIndex
public MVSecondaryIndex(Database db, MVTable table, int id, String indexName, IndexColumn[] columns, int uniqueColumnCount, IndexType indexType)
-
-
Method Details
-
addRowsToBuffer
Description copied from class:MVIndexAdd the rows to a temporary storage (not to the index yet). The rows are sorted by the index columns. This is to more quickly build the index.- Specified by:
addRowsToBufferin classMVIndex<SearchRow, Value>- Parameters:
rows- the rowsbufferName- the name of the temporary storage
-
addBufferedRows
Description copied from class:MVIndexAdd all the index data from the buffers to the index. The index will typically use merge sort to add the data more quickly in sorted order.- Specified by:
addBufferedRowsin classMVIndex<SearchRow, Value>- Parameters:
bufferNames- the names of the temporary storage
-
openMap
-
close
Description copied from class:IndexClose this index. -
add
Description copied from class:IndexAdd a row to the index. -
checkUnique
private void checkUnique(boolean repeatableRead, TransactionMap<SearchRow, Value> map, SearchRow row, long newKey) -
remove
Description copied from class:IndexRemove a row from the index. -
update
-
rowsAreEqual
-
find
Description copied from class:IndexFind a row or a list of rows and create a cursor to iterate over the result. -
find
-
convertToKey
-
getTable
-
getCost
public double getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet) Description copied from class:IndexEstimate the cost to search for rows given the search mask. There is one element per column in the search mask. For possible search masks, see IndexCondition.- Specified by:
getCostin classIndex- Parameters:
session- the sessionmasks- per-column comparison bit masks, null means 'always false', see constants in IndexConditionfilters- all joined table filtersfilter- the current table filter indexsortOrder- the sort orderallColumnsSet- the set of all columns- Returns:
- the estimated cost
-
remove
Description copied from class:IndexRemove the index. -
truncate
Description copied from class:IndexRemove all rows from the index. -
canGetFirstOrLast
public boolean canGetFirstOrLast()Description copied from class:IndexCheck if the index can directly look up the lowest or highest value of a column.- Overrides:
canGetFirstOrLastin classIndex- Returns:
- true if it can
-
findFirstOrLast
Description copied from class:IndexFind the first (or last) value of this index. The cursor returned is positioned on the correct row, or on null if no row has been found.- Overrides:
findFirstOrLastin classIndex- Parameters:
session- the sessionfirst- true if the first (lowest for ascending indexes) or last value should be returned- Returns:
- a cursor (never null)
-
needRebuild
public boolean needRebuild()Description copied from class:IndexCheck if the index needs to be rebuilt. This method is called after opening an index.- Specified by:
needRebuildin classIndex- Returns:
- true if a rebuild is required.
-
getRowCount
Description copied from class:IndexGet the row count of this table, for the given session.- Specified by:
getRowCountin classIndex- Parameters:
session- the session- Returns:
- the row count
-
getRowCountApproximation
Description copied from class:IndexGet the approximated row count for this table.- Specified by:
getRowCountApproximationin classIndex- Parameters:
session- the session- Returns:
- the approximated row count
-
getDiskSpaceUsed
public long getDiskSpaceUsed()Description copied from class:IndexGet the used disk space for this index.- Overrides:
getDiskSpaceUsedin classIndex- Returns:
- the estimated number of bytes
-
canFindNext
public boolean canFindNext()Description copied from class:IndexCheck if the index can get the next higher value.- Overrides:
canFindNextin classIndex- Returns:
- true if it can
-
findNext
Description copied from class:IndexFind a row or a list of rows that is larger and create a cursor to iterate over the result. -
getMap
Get the map to store the data.- Parameters:
session- the session- Returns:
- the map
-
getMVMap
-