Top Description Fields Constructors Methods
org.h2.mvstore.db

public Class MVDelegateIndex

extends MVIndex<Long, SearchRow>
Class Inheritance
Imports
java.util.List, org.h2.command.query.AllColumnsForPlan, org.h2.engine.SessionLocal, org.h2.index.Cursor, .IndexType, org.h2.message.DbException, org.h2.mvstore.MVMap, org.h2.result.Row, .RowFactory, .SearchRow, .SortOrder, org.h2.table.Column, .IndexColumn, .TableFilter, org.h2.value.VersionedValue

An index that delegates indexing to another index.

Field Summary

Modifier and TypeField and Description
private final MVPrimaryIndex

Constructor Summary

AccessConstructor and Description
public
MVDelegateIndex(MVTable table, int id, String name, MVPrimaryIndex mainIndex, IndexType indexType)

Method Summary

Modifier and TypeMethod and Description
public void
add(SessionLocal
the session to use
session
,
Row
the row to add
row
)

Implements abstract org.h2.index.Index.add.

Add a row to the index.

public void
addBufferedRows(List<String>
the names of the temporary storage
bufferNames
)

Implements abstract org.h2.mvstore.db.MVIndex.addBufferedRows.

Add all the index data from the buffers to the index.

public void
addRowsToBuffer(List<Row>
the rows
rows
,
String
the name of the temporary storage
bufferName
)

Implements abstract org.h2.mvstore.db.MVIndex.addRowsToBuffer.

Add the rows to a temporary storage (not to the index yet).

public boolean
canGetFirstOrLast()

Overrides org.h2.index.Index.canGetFirstOrLast.

Check if the index can directly look up the lowest or highest value of a column.

public void
close(SessionLocal
the session used to write data
session
)

Implements abstract org.h2.index.Index.close.

Close this index.

public Cursor
find(SessionLocal
the 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
)

Implements abstract org.h2.index.Index.find.

Find a row or a list of rows and create a cursor to iterate over the result.

public Cursor
findFirstOrLast(SessionLocal
the session
session
,
boolean
true if the first (lowest for ascending indexes) or last value should be returned
first
)

Overrides org.h2.index.Index.findFirstOrLast.

Find the first (or last) value of this index.

public int
getColumnIndex(Column
the column
col
)

Overrides org.h2.index.Index.getColumnIndex.

Get the index of a column in the list of index columns

public double
getCost(SessionLocal
the 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
)

Implements abstract org.h2.index.Index.getCost.

Estimate the cost to search for rows given the search mask.

public MVMap<Long, VersionedValue<SearchRow>>
public Row
getRow(SessionLocal
the session
session
,
long
the unique key
key
)

Overrides org.h2.index.Index.getRow.

Get the row with the given key.

public long
getRowCount(SessionLocal
the session
session
)

Implements abstract org.h2.index.Index.getRowCount.

Get the row count of this table, for the given session.

public long
getRowCountApproximation(SessionLocal
the session
session
)

Implements abstract org.h2.index.Index.getRowCountApproximation.

Get the approximated row count for this table.

public RowFactory
public boolean
isFirstColumn(Column
the column
column
)

Overrides org.h2.index.Index.isFirstColumn.

Check if the given column is the first for this index

public boolean
isRowIdIndex()

Overrides org.h2.index.Index.isRowIdIndex.

Does this index support lookup by row id?

public boolean
needRebuild()

Implements abstract org.h2.index.Index.needRebuild.

Check if the index needs to be rebuilt.

public void
remove(SessionLocal
the session
session
,
Row
the row
row
)

Implements abstract org.h2.index.Index.remove.

Remove a row from the index.

public void
remove(SessionLocal
the session
session
)

Implements abstract org.h2.index.Index.remove.

Remove the index.

public void
truncate(SessionLocal
the session
session
)

Implements abstract org.h2.index.Index.truncate.

Remove all rows from the index.

public void
update(SessionLocal
the session
session
,
Row
row before the update
oldRow
,
Row
row after the update
newRow
)

Overrides org.h2.index.Index.update.

Update index after row change.

Inherited from org.h2.mvstore.db.MVIndex:
getDiskSpaceUsed

Field Detail

mainIndexback to summary
private final MVPrimaryIndex mainIndex

Constructor Detail

MVDelegateIndexback to summary
public MVDelegateIndex(MVTable table, int id, String name, MVPrimaryIndex mainIndex, IndexType indexType)

Method Detail

addback to summary
public void add(SessionLocal session, Row row)

Implements abstract org.h2.index.Index.add.

Doc from org.h2.index.Index.add.

Add a row to the index.

Parameters
session:SessionLocal

the session to use

row:Row

the row to add

Annotations
@Override
addBufferedRowsback to summary
public void addBufferedRows(List<String> bufferNames)

Implements abstract org.h2.mvstore.db.MVIndex.addBufferedRows.

Doc from org.h2.mvstore.db.MVIndex.addBufferedRows.

Add 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.

Parameters
bufferNames:List<String>

the names of the temporary storage

Annotations
@Override
addRowsToBufferback to summary
public void addRowsToBuffer(List<Row> rows, String bufferName)

Implements abstract org.h2.mvstore.db.MVIndex.addRowsToBuffer.

Doc from org.h2.mvstore.db.MVIndex.addRowsToBuffer.

Add 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.

Parameters
rows:List<Row>

the rows

bufferName:String

the name of the temporary storage

Annotations
@Override
canGetFirstOrLastback to summary
public boolean canGetFirstOrLast()

Overrides org.h2.index.Index.canGetFirstOrLast.

Doc from org.h2.index.Index.canGetFirstOrLast.

Check if the index can directly look up the lowest or highest value of a column.

Returns:boolean

true if it can

Annotations
@Override
closeback to summary
public void close(SessionLocal session)

Implements abstract org.h2.index.Index.close.

Doc from org.h2.index.Index.close.

Close this index.

Parameters
session:SessionLocal

the session used to write data

Annotations
@Override
findback to summary
public Cursor find(SessionLocal session, SearchRow first, SearchRow last, boolean reverse)

Implements abstract org.h2.index.Index.find.

Doc from org.h2.index.Index.find.

Find a row or a list of rows and create a cursor to iterate over the result.

Parameters
session:SessionLocal

the session

first:SearchRow

the first row, or null for no limit

last:SearchRow

the last row, or null for no limit

reverse:boolean

if true, iterate in reverse (descending) order

Returns:Cursor

the cursor to iterate over the results

Annotations
@Override
findFirstOrLastback to summary
public Cursor findFirstOrLast(SessionLocal session, boolean first)

Overrides org.h2.index.Index.findFirstOrLast.

Doc from org.h2.index.Index.findFirstOrLast.

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.

Parameters
session:SessionLocal

the session

first:boolean

true if the first (lowest for ascending indexes) or last value should be returned

Returns:Cursor

a cursor (never null)

Annotations
@Override
getColumnIndexback to summary
public int getColumnIndex(Column col)

Overrides org.h2.index.Index.getColumnIndex.

Doc from org.h2.index.Index.getColumnIndex.

Get the index of a column in the list of index columns

Parameters
col:Column

the column

Returns:int

the index (0 meaning first column)

Annotations
@Override
getCostback to summary
public double getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet)

Implements abstract org.h2.index.Index.getCost.

Doc from org.h2.index.Index.getCost.

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.

Parameters
session:SessionLocal

the session

masks:int[]

per-column comparison bit masks, null means 'always false', see constants in IndexCondition

filters:TableFilter[]

all joined table filters

filter:int

the current table filter index

sortOrder:SortOrder

the sort order

allColumnsSet:AllColumnsForPlan

the set of all columns

Returns:double

the estimated cost

Annotations
@Override
getMVMapback to summary
public MVMap<Long, VersionedValue<SearchRow>> getMVMap()

Implements abstract org.h2.mvstore.db.MVIndex.getMVMap.

Annotations
@Override
getRowback to summary
public Row getRow(SessionLocal session, long key)

Overrides org.h2.index.Index.getRow.

Doc from org.h2.index.Index.getRow.

Get the row with the given key.

Parameters
session:SessionLocal

the session

key:long

the unique key

Returns:Row

the row

Annotations
@Override
getRowCountback to summary
public long getRowCount(SessionLocal session)

Implements abstract org.h2.index.Index.getRowCount.

Doc from org.h2.index.Index.getRowCount.

Get the row count of this table, for the given session.

Parameters
session:SessionLocal

the session

Returns:long

the row count

Annotations
@Override
getRowCountApproximationback to summary
public long getRowCountApproximation(SessionLocal session)

Implements abstract org.h2.index.Index.getRowCountApproximation.

Doc from org.h2.index.Index.getRowCountApproximation.

Get the approximated row count for this table.

Parameters
session:SessionLocal

the session

Returns:long

the approximated row count

Annotations
@Override
getRowFactoryback to summary
public RowFactory getRowFactory()

Overrides org.h2.index.Index.getRowFactory.

Annotations
@Override
isFirstColumnback to summary
public boolean isFirstColumn(Column column)

Overrides org.h2.index.Index.isFirstColumn.

Doc from org.h2.index.Index.isFirstColumn.

Check if the given column is the first for this index

Parameters
column:Column

the column

Returns:boolean

true if the given columns is the first

Annotations
@Override
isRowIdIndexback to summary
public boolean isRowIdIndex()

Overrides org.h2.index.Index.isRowIdIndex.

Doc from org.h2.index.Index.isRowIdIndex.

Does this index support lookup by row id?

Returns:boolean

true if it does

Annotations
@Override
needRebuildback to summary
public boolean needRebuild()

Implements abstract org.h2.index.Index.needRebuild.

Doc from org.h2.index.Index.needRebuild.

Check if the index needs to be rebuilt. This method is called after opening an index.

Returns:boolean

true if a rebuild is required.

Annotations
@Override
removeback to summary
public void remove(SessionLocal session, Row row)

Implements abstract org.h2.index.Index.remove.

Doc from org.h2.index.Index.remove.

Remove a row from the index.

Parameters
session:SessionLocal

the session

row:Row

the row

Annotations
@Override
removeback to summary
public void remove(SessionLocal session)

Implements abstract org.h2.index.Index.remove.

Doc from org.h2.index.Index.remove.

Remove the index.

Parameters
session:SessionLocal

the session

Annotations
@Override
truncateback to summary
public void truncate(SessionLocal session)

Implements abstract org.h2.index.Index.truncate.

Doc from org.h2.index.Index.truncate.

Remove all rows from the index.

Parameters
session:SessionLocal

the session

Annotations
@Override
updateback to summary
public void update(SessionLocal session, Row oldRow, Row newRow)

Overrides org.h2.index.Index.update.

Doc from org.h2.index.Index.update.

Update index after row change.

Parameters
session:SessionLocal

the session

oldRow:Row

row before the update

newRow:Row

row after the update

Annotations
@Override