Package org.h2.index
Class LinkedIndex
java.lang.Object
org.h2.engine.DbObject
org.h2.schema.SchemaObject
org.h2.index.Index
org.h2.index.LinkedIndex
- All Implemented Interfaces:
HasSQL
A linked index is a index for a linked (remote) table.
It is backed by an index on the remote table which is accessed over JDBC.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TableLink
private long
private final int
private final String
Fields inherited from class org.h2.index.Index
columnIds, columns, indexColumns, indexType, table, uniqueColumnColumn
Fields inherited from class org.h2.engine.DbObject
AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USER
Fields inherited from interface org.h2.util.HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS
-
Constructor Summary
ConstructorsConstructorDescriptionLinkedIndex
(TableLink table, int id, IndexColumn[] columns, int uniqueColumnCount, IndexType indexType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(SessionLocal session, Row row) Add a row to the index.private void
addParameter
(StringBuilder builder, Column col) void
Check if renaming is allowed.void
close
(SessionLocal session) Close this index.find
(SessionLocal session, SearchRow first, SearchRow last) Find a row or a list of rows and create a cursor to iterate over the result.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.Construct the CREATE ...long
getRowCount
(SessionLocal session) Get the row count of this table, for the given session.long
getRowCountApproximation
(SessionLocal session) Get the approximated row count for this table.private static boolean
boolean
Check if the index needs to be rebuilt.void
remove
(SessionLocal session) Remove the index.void
remove
(SessionLocal session, Row row) Remove a row from the index.void
truncate
(SessionLocal session) Remove all rows from the index.void
update
(Row oldRow, Row newRow, SessionLocal session) Update a row using a UPDATE statement.Methods inherited from class org.h2.index.Index
canFindNext, canGetFirstOrLast, canScan, checkIndexColumnTypes, compareRows, findFirstOrLast, findNext, getColumnIndex, getColumns, getCostRangeIndex, getCreateSQLForCopy, getDiskSpaceUsed, getDuplicateKeyException, getDuplicatePrimaryKeyMessage, getIndexColumns, getIndexType, getPlanSQL, getRow, getRowFactory, getTable, getType, getUniqueColumnCount, getUniqueRowFactory, isFindUsingFullTableScan, isFirstColumn, isHidden, isRowIdIndex, mayHaveNullDuplicates, removeChildrenAndResources, update
Methods inherited from class org.h2.schema.SchemaObject
getSchema, getSQL, getSQL
Methods inherited from class org.h2.engine.DbObject
getChildren, getComment, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.h2.util.HasSQL
getTraceSQL
-
Field Details
-
link
-
targetTableName
-
rowCount
private long rowCount -
sqlFlags
private final int sqlFlags- See Also:
-
-
Constructor Details
-
LinkedIndex
public LinkedIndex(TableLink table, int id, IndexColumn[] columns, int uniqueColumnCount, IndexType indexType)
-
-
Method Details
-
getCreateSQL
Description copied from class:DbObject
Construct the CREATE ... SQL statement for this object.- Overrides:
getCreateSQL
in classIndex
- Returns:
- the SQL statement
-
close
Description copied from class:Index
Close this index. -
isNull
-
add
Description copied from class:Index
Add a row to the index. -
find
Description copied from class:Index
Find a row or a list of rows and create a cursor to iterate over the result. -
addParameter
-
getCost
public double getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet) Description copied from class:Index
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.- Specified by:
getCost
in 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:Index
Remove the index. -
truncate
Description copied from class:Index
Remove all rows from the index. -
checkRename
public void checkRename()Description copied from class:DbObject
Check if renaming is allowed. Does nothing when allowed.- Overrides:
checkRename
in classDbObject
-
needRebuild
public boolean needRebuild()Description copied from class:Index
Check if the index needs to be rebuilt. This method is called after opening an index.- Specified by:
needRebuild
in classIndex
- Returns:
- true if a rebuild is required.
-
remove
Description copied from class:Index
Remove a row from the index. -
update
Update a row using a UPDATE statement. This method is to be called if the emit updates option is enabled.- Parameters:
oldRow
- the old datanewRow
- the new datasession
- the session
-
getRowCount
Description copied from class:Index
Get the row count of this table, for the given session.- Specified by:
getRowCount
in classIndex
- Parameters:
session
- the session- Returns:
- the row count
-
getRowCountApproximation
Description copied from class:Index
Get the approximated row count for this table.- Specified by:
getRowCountApproximation
in classIndex
- Parameters:
session
- the session- Returns:
- the approximated row count
-