| Modifier and Type | Field and Description |
|---|---|
| protected int[] | columnIds
Identities of table columns. |
| protected Column[] | columns
Table columns used in this index. |
| protected IndexColumn[] | indexColumns
Columns of this index. |
| protected final IndexType | indexType
The index type. |
| private final RowFactory | |
| protected final Table | table
The table. |
| protected final int | uniqueColumnColumn
Count of unique columns. |
| private final RowFactory |
| Access | Constructor and Description |
|---|---|
| protected | Index(Table
the table newTable, int the object id id, String the index name name, IndexColumn[] the columns that are indexed or null if this is
not yet known newIndexColumns, int count of unique columns uniqueColumnCount, IndexType the index type newIndexType)Initialize the index. |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | |
| public boolean | |
| public boolean | Returns: true if it canCheck if the index can directly look up the lowest or highest value of a column. |
| public boolean | |
| protected static void | checkIndexColumnTypes(IndexColumn[]
the columns columns)Check that the index columns are not CLOB or BLOB. |
| public abstract void | |
| public final int | Returns: 0 if both rows are equal, -1 if the first row is smaller, otherwise 1the first row rowData, SearchRow the second row compare)Compare two rows. |
| private int | |
| public abstract Cursor | Returns: the cursor to iterate over the resultsthe session session, SearchRow the first row, or null for no limit first, SearchRow the last row, or null for no limit last, boolean if true, iterate in reverse (descending) order reverse)Find a row or a list of rows and create a cursor to iterate over the result. |
| public Cursor | Returns: a cursor (never null)the session session, boolean true if the first (lowest for ascending indexes) or last
value should be returned first)Find the first (or last) value of this index. |
| public Cursor | Returns: the cursorthe session session, SearchRow the lower limit (excluding) higherThan, SearchRow the last row, or null for no limit last)Find a row or a list of rows that is larger and create a cursor to iterate over the result. |
| public int | Returns: the index (0 meaning first column)the column col)Get the index of a column in the list of index columns |
| private StringBuilder | Returns: the list of columnsformatting flags sqlFlags)Get the list of columns as a string. |
| public final Column[] | |
| public abstract double | Returns: the estimated costthe session session, int[] per-column comparison bit masks, null means 'always false',
see constants in IndexCondition masks, TableFilter[] all joined table filters filters, int the current table filter index filter, SortOrder the sort order sortOrder, AllColumnsForPlan the set of all columns allColumnsSet)Estimate the cost to search for rows given the search mask. |
| protected final long | Returns: the estimated costthe IndexCondition search masks, one for each column in the
table masks, long the number of rows in the index rowCount, TableFilter[] all joined table filters filters, int the current table filter index filter, SortOrder the sort order sortOrder, boolean whether this is a "table scan" index isScanIndex, AllColumnsForPlan the set of all columns allColumnsSet)Calculate the cost for the given mask as if this index was a typical b-tree range index. |
| public String | |
| public String | getCreateSQLForCopy(Table
the new table targetTable, String the quoted name quotedName)Overrides org. Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table |
| public long | Returns: the estimated number of bytestrue to return quick approximationGet the used disk space for this index. |
| public DbException | Returns: the exceptionthe key values key)Create a duplicate key exception with a message that contains the index name. |
| protected StringBuilder | Returns: the messagethe column index mainIndexColumn)Get "PRIMARY KEY ON <table> [(column)]". |
| public final IndexColumn[] | Returns: the index columnsGet the indexed columns as index columns (with ordering information). |
| public final IndexType | |
| public String | |
| public Row | Returns: the rowthe session session, long the unique key key)Get the row with the given key. |
| public abstract long | Returns: the row countthe session session)Get the row count of this table, for the given session. |
| public abstract long | Returns: the approximated row countthe session session)Get the approximated row count for this table. |
| public RowFactory | |
| public Table | |
| public final int | |
| public final int | Returns: count of unique columns, or 0 if index isn't uniqueReturns count of unique columns. |
| public RowFactory | |
| public boolean | Returns: true if find() implementation performs scan over all
index, false if find() performs the fast lookupReturns |
| public boolean | Returns: true if the given columns is the firstthe column column)Check if the given column is the first for this index |
| public boolean | |
| public abstract boolean | |
| public final boolean | Returns: true if check for duplicates is required,
false otherwisethe row to check searchRow)Check if this row needs to be checked for duplicates. |
| private boolean | |
| public abstract void | |
| public abstract void | |
| public void | removeChildrenAndResources(SessionLocal
the session session)Implements abstract org. Delete all dependent children objects and resources of this object. |
| public abstract void | |
| public void | update(SessionLocal
the session session, Row row before the update oldRow, Row row after the update newRow)Update index after row change. |
| columnIds | back to summary |
|---|---|
| protected int[] columnIds Identities of table columns. | |
| columns | back to summary |
|---|---|
| protected Column[] columns Table columns used in this index. | |
| indexColumns | back to summary |
|---|---|
| protected IndexColumn[] indexColumns Columns of this index. | |
| indexType | back to summary |
|---|---|
| protected final IndexType indexType The index type. | |
| rowFactory | back to summary |
|---|---|
| private final RowFactory rowFactory | |
| table | back to summary |
|---|---|
| protected final Table table The table. | |
| uniqueColumnColumn | back to summary |
|---|---|
| protected final int uniqueColumnColumn Count of unique columns. Unique columns, if any, are always first columns in the lists. | |
| uniqueRowFactory | back to summary |
|---|---|
| private final RowFactory uniqueRowFactory | |
| Index | back to summary |
|---|---|
| protected Index(Table newTable, int id, String name, IndexColumn[] newIndexColumns, int uniqueColumnCount, IndexType newIndexType) Initialize the index.
| |
| add | back to summary |
|---|---|
| public abstract void add(SessionLocal session, Row row) Add a row to the index.
| |
| canFindNext | back to summary |
|---|---|
| public boolean canFindNext() Check if the index can get the next higher value.
| |
| canGetFirstOrLast | back to summary |
|---|---|
| public boolean canGetFirstOrLast() Check if the index can directly look up the lowest or highest value of a column.
| |
| canScan | back to summary |
|---|---|
| public boolean canScan() Can this index iterate over all rows?
| |
| checkIndexColumnTypes | back to summary |
|---|---|
| protected static void checkIndexColumnTypes(IndexColumn[] columns) Check that the index columns are not CLOB or BLOB.
| |
| close | back to summary |
|---|---|
| public abstract void close(SessionLocal session) Close this index.
| |
| compareRows | back to summary |
|---|---|
| public final int compareRows(SearchRow rowData, SearchRow compare) Compare two rows. | |
| compareValues | back to summary |
|---|---|
| private int compareValues(Value a, Value b, int sortType) | |
| find | back to summary |
|---|---|
| public abstract Cursor find(SessionLocal session, SearchRow first, SearchRow last, boolean reverse) Find a row or a list of rows and create a cursor to iterate over the result.
| |
| findFirstOrLast | back to summary |
|---|---|
| public Cursor findFirstOrLast(SessionLocal session, boolean first) Find 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.
| |
| findNext | back to summary |
|---|---|
| public Cursor 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.
| |
| getColumnIndex | back to summary |
|---|---|
| public int getColumnIndex(Column col) Get the index of a column in the list of index columns
| |
| getColumnListSQL | back to summary |
|---|---|
| private StringBuilder getColumnListSQL(StringBuilder builder, int sqlFlags) Get the list of columns as a string.
| |
| getColumns | back to summary |
|---|---|
| public final Column[] getColumns() Get the indexed columns.
| |
| getCost | back to summary |
|---|---|
| public abstract double getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet) Estimate 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.
| |
| getCostRangeIndex | back to summary |
|---|---|
| protected final long getCostRangeIndex(int[] masks, long rowCount, TableFilter[] filters, int filter, SortOrder sortOrder, boolean isScanIndex, AllColumnsForPlan allColumnsSet) Calculate the cost for the given mask as if this index was a typical b-tree range index. This is the estimated cost required to search one row, and then iterate over the given number of rows.
| |
| getCreateSQL | back to summary |
|---|---|
| public String getCreateSQL() Implements abstract org. Doc from org. Construct the CREATE ... SQL statement for this object. | |
| getCreateSQLForCopy | back to summary |
|---|---|
| public String getCreateSQLForCopy(Table targetTable, String quotedName) Overrides org. Doc from org. Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table | |
| getDiskSpaceUsed | back to summary |
|---|---|
| public long getDiskSpaceUsed(boolean approximate) Get the used disk space for this index.
| |
| getDuplicateKeyException | back to summary |
|---|---|
| public DbException getDuplicateKeyException(String key) Create a duplicate key exception with a message that contains the index name.
| |
| getDuplicatePrimaryKeyMessage | back to summary |
|---|---|
| protected StringBuilder getDuplicatePrimaryKeyMessage(int mainIndexColumn) Get "PRIMARY KEY ON <table> [(column)]".
| |
| getIndexColumns | back to summary |
|---|---|
| public final IndexColumn[] getIndexColumns() Get the indexed columns as index columns (with ordering information).
| |
| getIndexType | back to summary |
|---|---|
| public final IndexType getIndexType() Get the index type.
| |
| getPlanSQL | back to summary |
|---|---|
| public String getPlanSQL() Get the message to show in a EXPLAIN statement.
| |
| getRow | back to summary |
|---|---|
| public Row getRow(SessionLocal session, long key) Get the row with the given key.
| |
| getRowCount | back to summary |
|---|---|
| public abstract long getRowCount(SessionLocal session) Get the row count of this table, for the given session.
| |
| getRowCountApproximation | back to summary |
|---|---|
| public abstract long getRowCountApproximation(SessionLocal session) Get the approximated row count for this table.
| |
| getRowFactory | back to summary |
|---|---|
| public RowFactory getRowFactory() | |
| getTable | back to summary |
|---|---|
| public Table getTable() Get the table on which this index is based.
| |
| getType | back to summary |
|---|---|
| public final int getType() Implements abstract org. Doc from org. Get the object type.
| |
| getUniqueColumnCount | back to summary |
|---|---|
| public final int getUniqueColumnCount() Returns count of unique columns. Unique columns, if any, are always first columns in the lists. Unique indexes may have additional indexed non-unique columns.
| |
| getUniqueRowFactory | back to summary |
|---|---|
| public RowFactory getUniqueRowFactory() | |
| isFindUsingFullTableScan | back to summary |
|---|---|
| public boolean isFindUsingFullTableScan() Returns
| |
| isFirstColumn | back to summary |
|---|---|
| public boolean isFirstColumn(Column column) Check if the given column is the first for this index
| |
| isRowIdIndex | back to summary |
|---|---|
| public boolean isRowIdIndex() Does this index support lookup by row id?
| |
| needRebuild | back to summary |
|---|---|
| public abstract boolean needRebuild() Check if the index needs to be rebuilt. This method is called after opening an index.
| |
| needsUniqueCheck | back to summary |
|---|---|
| public final boolean needsUniqueCheck(SearchRow searchRow) Check if this row needs to be checked for duplicates.
| |
| needsUniqueCheck | back to summary |
|---|---|
| private boolean needsUniqueCheck(SearchRow searchRow, boolean distinct) | |
| remove | back to summary |
|---|---|
| public abstract void remove(SessionLocal session, Row row) Remove a row from the index.
| |
| remove | back to summary |
|---|---|
| public abstract void remove(SessionLocal session) Remove the index.
| |
| removeChildrenAndResources | back to summary |
|---|---|
| public void removeChildrenAndResources(SessionLocal session) Implements abstract org. Doc from org. Delete all dependent children objects and resources of this object.
| |
| truncate | back to summary |
|---|---|
| public abstract void truncate(SessionLocal session) Remove all rows from the index.
| |
| update | back to summary |
|---|---|
| public void update(SessionLocal session, Row oldRow, Row newRow) Update index after row change.
| |