Top Description Fields Constructors Methods
org.h2.index

public Class MetaIndex

extends Index
Class Inheritance
Imports
java.util.ArrayList, org.h2.command.query.AllColumnsForPlan, org.h2.engine.SessionLocal, org.h2.message.DbException, org.h2.result.Row, .SearchRow, .SortOrder, org.h2.table.Column, .IndexColumn, .MetaTable, .TableFilter

The index implementation for meta data tables.

Field Summary

Modifier and TypeField and Description
private final MetaTable
private final boolean
Inherited from org.h2.index.Index:
columnIdscolumnsindexColumnsindexTypetableuniqueColumnColumn

Constructor Summary

AccessConstructor and Description
public
MetaIndex(MetaTable meta, IndexColumn[] columns, boolean scan)

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
checkRename()

Overrides org.h2.engine.DbObject.checkRename.

Check if renaming is allowed.

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 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 String
getCreateSQL()

Overrides org.h2.index.Index.getCreateSQL.

Construct the CREATE ...

public long
getDiskSpaceUsed(boolean
true to return quick approximation
approximate
)

Overrides org.h2.index.Index.getDiskSpaceUsed.

Get the used disk space for this index.

public String
getPlanSQL()

Overrides org.h2.index.Index.getPlanSQL.

Get the message to show in a EXPLAIN statement.

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

Inherited from org.h2.index.Index:
canFindNextcanGetFirstOrLastcanScancheckIndexColumnTypescompareRowsfindFirstOrLastfindNextgetColumnsgetCostRangeIndexgetCreateSQLForCopygetDuplicateKeyExceptiongetDuplicatePrimaryKeyMessagegetIndexColumnsgetIndexTypegetRowgetRowFactorygetTablegetTypegetUniqueColumnCountgetUniqueRowFactoryisFindUsingFullTableScanisRowIdIndexneedsUniqueCheckremoveChildrenAndResourcesupdate

Field Detail

metaback to summary
private final MetaTable meta
scanback to summary
private final boolean scan

Constructor Detail

MetaIndexback to summary
public MetaIndex(MetaTable meta, IndexColumn[] columns, boolean scan)

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
checkRenameback to summary
public void checkRename()

Overrides org.h2.engine.DbObject.checkRename.

Doc from org.h2.engine.DbObject.checkRename.

Check if renaming is allowed. Does nothing when allowed.

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
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
getCreateSQLback to summary
public String getCreateSQL()

Overrides org.h2.index.Index.getCreateSQL.

Doc from org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ... SQL statement for this object.

Returns:String

the SQL statement

Annotations
@Override
getDiskSpaceUsedback to summary
public long getDiskSpaceUsed(boolean approximate)

Overrides org.h2.index.Index.getDiskSpaceUsed.

Doc from org.h2.index.Index.getDiskSpaceUsed.

Get the used disk space for this index.

Parameters
approximate:boolean

true to return quick approximation

Returns:long

the estimated number of bytes

Annotations
@Override
getPlanSQLback to summary
public String getPlanSQL()

Overrides org.h2.index.Index.getPlanSQL.

Doc from org.h2.index.Index.getPlanSQL.

Get the message to show in a EXPLAIN statement.

Returns:String

the plan

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