IndexLookupBatch
Support for asynchronous batched lookups in indexes. The flow is the
following: H2 engine will be calling
{@link #addSearchRows(SearchRow, SearchRow)} until method
{@link #isBatchFull()} will return {@code true} or there are no more search
rows to add. Then method {@link #find()} will be called to execute batched
lookup. Note that a single instance of {@link IndexLookupBatch} can be reused
for multiple sequential batched lookups, moreover it can be reused for
multiple queries for the same prepared statement.
| Methods |
| boolean |
addSearchRows(SearchRow first, SearchRow last)
Add search row pair to the batch.
|
| boolean |
addSearchRows(SearchRow first, SearchRow last)
Add search row pair to the batch.
Parameters:
first - the first row, or null for no limit
last - the last row, or null for no limit
Returns:
{@code false} if this search row pair is known to produce no
results and thus the given row pair was not added
|
| List |
find()
Execute batched lookup and return future cursor for each provided search
row pair.
|
| List |
find()
Execute batched lookup and return future cursor for each provided search
row pair. Note that this method must return exactly the same number of
future cursors in result list as number of
{@link #addSearchRows(SearchRow, SearchRow)} calls has been done before
{@link #find()} call exactly in the same order.
Returns:
List of future cursors for collected search rows.
|
| String |
getPlanSQL()
Get plan for EXPLAIN.
|
| String |
getPlanSQL()
Get plan for EXPLAIN.
Returns:
plan
|
| boolean |
isBatchFull()
Check if this batch is full.
|
| boolean |
isBatchFull()
Check if this batch is full.
Returns:
{@code true} If batch is full, will not accept any
more rows and {@link #find()} can be executed.
|
| void |
reset(boolean beforeQuery)
Reset this batch to clear state.
|
| void |
reset(boolean beforeQuery)
Reset this batch to clear state. This method will be called before and
after each query execution.
Parameters:
beforeQuery - if it is being called before query execution
|
|