public interface Index extends SchemaObject
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE
Modifier and Type | Method and Description |
---|---|
void |
add(Session session,
Row row)
Add a row to the index.
|
boolean |
canFindNext()
Check if the index can get the next higher value.
|
boolean |
canGetFirstOrLast()
Check if the index can directly look up the lowest or highest value of a
column.
|
boolean |
canScan()
Can this index iterate over all rows?
|
void |
close(Session session)
Close this index.
|
void |
commit(int operation,
Row row)
Commit the operation for a row.
|
int |
compareRows(SearchRow rowData,
SearchRow compare)
Compare two rows.
|
IndexLookupBatch |
createLookupBatch(TableFilter[] filters,
int filter)
Creates new lookup batch.
|
Cursor |
find(Session session,
SearchRow first,
SearchRow last)
Find a row or a list of rows and create a cursor to iterate over the
result.
|
Cursor |
find(TableFilter filter,
SearchRow first,
SearchRow last)
Find a row or a list of rows and create a cursor to iterate over the
result.
|
Cursor |
findFirstOrLast(Session session,
boolean first)
Find the first (or last) value of this index.
|
Cursor |
findNext(Session 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.
|
int |
getColumnIndex(Column col)
Get the index of a column in the list of index columns
|
Column[] |
getColumns()
Get the indexed columns.
|
double |
getCost(Session session,
int[] masks,
TableFilter[] filters,
int filter,
SortOrder sortOrder,
HashSet<Column> allColumnsSet)
Estimate the cost to search for rows given the search mask.
|
long |
getDiskSpaceUsed()
Get the used disk space for this index.
|
IndexColumn[] |
getIndexColumns()
Get the indexed columns as index columns (with ordering information).
|
IndexType |
getIndexType()
Get the index type.
|
String |
getPlanSQL()
Get the message to show in a EXPLAIN statement.
|
Row |
getRow(Session session,
long key)
Get the row with the given key.
|
long |
getRowCount(Session session)
Get the row count of this table, for the given session.
|
long |
getRowCountApproximation()
Get the approximated row count for this table.
|
Table |
getTable()
Get the table on which this index is based.
|
boolean |
isFindUsingFullTableScan()
Returns
true if find() implementation performs scan over all
index, false if find() performs the fast lookup. |
boolean |
isFirstColumn(Column column)
Check if the given column is the first for this index
|
boolean |
isRowIdIndex()
Does this index support lookup by row id?
|
boolean |
needRebuild()
Check if the index needs to be rebuilt.
|
void |
remove(Session session)
Remove the index.
|
void |
remove(Session session,
Row row)
Remove a row from the index.
|
void |
setSortedInsertMode(boolean sortedInsertMode)
Enable or disable the 'sorted insert' optimizations (rows are inserted in
ascending or descending order) if applicable for this index
implementation.
|
void |
truncate(Session session)
Remove all rows from the index.
|
getSchema, isHidden
checkRename, getChildren, getComment, getCreateSQL, getCreateSQLForCopy, getDatabase, getDropSQL, getId, getName, getSQL, getType, isTemporary, removeChildrenAndResources, rename, setComment, setTemporary
String getPlanSQL()
void close(Session session)
session
- the session used to write datavoid add(Session session, Row row)
session
- the session to userow
- the row to addvoid remove(Session session, Row row)
session
- the sessionrow
- the rowboolean isFindUsingFullTableScan()
true
if find()
implementation performs scan over all
index, false
if find()
performs the fast lookup.true
if find()
implementation performs scan over all
index, false
if find()
performs the fast lookupCursor find(Session session, SearchRow first, SearchRow last)
session
- the sessionfirst
- the first row, or null for no limitlast
- the last row, or null for no limitCursor find(TableFilter filter, SearchRow first, SearchRow last)
filter
- the table filter (which possibly knows about additional
conditions)first
- the first row, or null for no limitlast
- the last row, or null for no limitdouble getCost(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet<Column> allColumnsSet)
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 columnsvoid remove(Session session)
session
- the sessionvoid truncate(Session session)
session
- the sessionboolean canGetFirstOrLast()
boolean canFindNext()
Cursor findNext(Session session, SearchRow higherThan, SearchRow last)
session
- the sessionhigherThan
- the lower limit (excluding)last
- the last row, or null for no limitCursor findFirstOrLast(Session session, boolean first)
session
- the sessionfirst
- true if the first (lowest for ascending indexes) or last
value should be returnedboolean needRebuild()
long getRowCount(Session session)
session
- the sessionlong getRowCountApproximation()
long getDiskSpaceUsed()
int compareRows(SearchRow rowData, SearchRow compare)
rowData
- the first rowcompare
- the second rowint getColumnIndex(Column col)
col
- the columnboolean isFirstColumn(Column column)
column
- the columnIndexColumn[] getIndexColumns()
Column[] getColumns()
IndexType getIndexType()
Table getTable()
void commit(int operation, Row row)
operation
- the operation typerow
- the rowRow getRow(Session session, long key)
session
- the sessionkey
- the unique keyboolean isRowIdIndex()
boolean canScan()
void setSortedInsertMode(boolean sortedInsertMode)
sortedInsertMode
- the new valueIndexLookupBatch createLookupBatch(TableFilter[] filters, int filter)
IndexLookupBatch
instance can be used multiple times.filters
- the table filtersfilter
- the filter index (0, 1,...)null
if batched lookup is not supported
by this index.Copyright © 2020 JBoss by Red Hat. All rights reserved.