org.apache.ignite.configuration

## Class QueryConfiguration

- java.lang.Object
- - org.apache.ignite.configuration.QueryConfiguration

    public class QueryConfiguration
    extends Object

Configuration for embedded indexing facilities.

### Field Summary

Fields
`static long` `DFLT_LONG_QRY_EXEC_TIMEOUT` Default query execution time interpreted as long query (3 seconds).
`static boolean` `DFLT_USE_OPTIMIZED_SERIALIZER` Default value for `setUseOptimizedSerializer(boolean)` flag.

### Constructor Summary

Constructors
Constructor and Description
`QueryConfiguration()`

### Method Summary

Methods
`Class<?>[]` `getIndexCustomFunctionClasses()` Gets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.
`String` `getInitialScriptPath()` Gets script path to be ran against H2 database after opening.
`long` `getLongQueryExecutionTimeout()` Get long query execution time timeout.
`long` `getMaxOffHeapMemory()` Gets maximum amount of memory available to off-heap storage.
`String[]` `getSearchPath()` Gets the optional search path consisting of space names to search SQL schema objects.
`boolean` `isLongQueryExplain()` Gets flag marking SPI should print SQL execution plan for long queries (explain SQL query).
`boolean` `isUseOptimizedSerializer()` The flag indicating that serializer for H2 database will be set to Ignite's marshaller.
`void` `setIndexCustomFunctionClasses(Class<?>... idxCustomFuncClss)` Sets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.
`void` `setInitialScriptPath(String initScriptPath)` Sets script path to be ran against H2 database after opening.
`void` `setLongQueryExecutionTimeout(long longQryExecTimeout)` Set query execution time threshold.
`void` `setLongQueryExplain(boolean longQryExplain)` If `true`, SPI will print SQL execution plan for long queries (explain SQL query).
`void` `setMaxOffHeapMemory(long maxOffHeapMemory)` Sets maximum amount of memory available to off-heap storage.
`void` `setMaxOffheapRowsCacheSize(int size)` Specifies max allowed size of cache for deserialized offheap rows to avoid deserialization costs for most frequently used ones.
`void` `setSearchPath(String... searchPath)` Sets the optional search path consisting of space names to search SQL schema objects.
`void` `setUseOptimizedSerializer(boolean useOptimizedSerializer)` The flag indicating that serializer for H2 database will be set to Ignite's marshaller.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DFLT_LONG_QRY_EXEC_TIMEOUT

    public static final long DFLT_LONG_QRY_EXEC_TIMEOUT

Default query execution time interpreted as long query (3 seconds).

See Also:
  Constant Field Values

#### DFLT_USE_OPTIMIZED_SERIALIZER

    public static final boolean DFLT_USE_OPTIMIZED_SERIALIZER

Default value for `setUseOptimizedSerializer(boolean)` flag.

See Also:
  Constant Field Values

### Constructor Detail

#### QueryConfiguration

    public QueryConfiguration()

### Method Detail

#### setMaxOffHeapMemory

    public void setMaxOffHeapMemory(long maxOffHeapMemory)

Sets maximum amount of memory available to off-heap storage. Possible values are

- `-1` - Means that off-heap storage is disabled.
- `0` - Ignite will not limit off-heap storage (it's up to user to properly add and remove entries from cache to ensure that off-heap storage does not grow indefinitely.
- Any positive value specifies the limit of off-heap storage in bytes.

Default value is `-1`, which means that off-heap storage is disabled by default.

Use off-heap storage to load gigabytes of data in memory without slowing down Garbage Collection. Essentially in this case you should allocate very small amount of memory to JVM and Ignite will cache most of the data in off-heap space without affecting JVM performance at all.

Parameters:
  `maxOffHeapMemory` - Maximum memory in bytes available to off-heap memory space.

#### getMaxOffHeapMemory

    public long getMaxOffHeapMemory()

Gets maximum amount of memory available to off-heap storage.

Returns:
  Maximum memory in bytes available to off-heap memory space.

#### setMaxOffheapRowsCacheSize

    public void setMaxOffheapRowsCacheSize(int size)

Specifies max allowed size of cache for deserialized offheap rows to avoid deserialization costs for most frequently used ones. In general performance is better with greater cache size. Must be more than 128 items.

Parameters:
  `size` - Cache size in items.

#### setSearchPath

    public void setSearchPath(String... searchPath)

Sets the optional search path consisting of space names to search SQL schema objects. Useful for cross cache queries to avoid writing fully qualified table names.

Parameters:
  `searchPath` - Search path.

#### getSearchPath

    @Nullable
    public String[] getSearchPath()

Gets the optional search path consisting of space names to search SQL schema objects.

Returns:
  Search path.

#### getInitialScriptPath

    @Nullable
    public String getInitialScriptPath()

Gets script path to be ran against H2 database after opening.

Returns:
  Script path.

#### setInitialScriptPath

    public void setInitialScriptPath(String initScriptPath)

Sets script path to be ran against H2 database after opening. The script must be UTF-8 encoded file.

Parameters:
  `initScriptPath` - Script path.

#### setIndexCustomFunctionClasses

    public void setIndexCustomFunctionClasses(Class<?>... idxCustomFuncClss)

Sets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.

Parameters:
  `idxCustomFuncClss` - List of classes.

#### getIndexCustomFunctionClasses

    @Nullable
    public Class<?>[] getIndexCustomFunctionClasses()

Gets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.

Returns:
  List of classes.

#### getLongQueryExecutionTimeout

    public long getLongQueryExecutionTimeout()

Get long query execution time timeout.

Returns:
  Long query execution timeout.

#### setLongQueryExecutionTimeout

    public void setLongQueryExecutionTimeout(long longQryExecTimeout)

Set query execution time threshold. If queries exceed this threshold, then a warning will be printed out. If `setLongQueryExplain(boolean)` is set to `true`, then execution plan will be printed out as well.

If not provided, default value is defined by `DFLT_LONG_QRY_EXEC_TIMEOUT`.

Parameters:
  `longQryExecTimeout` - Long query execution timeout.
See Also:
  `setLongQueryExplain(boolean)`

#### isLongQueryExplain

    public boolean isLongQueryExplain()

Gets flag marking SPI should print SQL execution plan for long queries (explain SQL query).

Returns:
  Flag marking SPI should print SQL execution plan for long queries (explain SQL query).

#### setLongQueryExplain

    public void setLongQueryExplain(boolean longQryExplain)

If `true`, SPI will print SQL execution plan for long queries (explain SQL query). The time threshold of long queries is controlled via `setLongQueryExecutionTimeout(long)` parameter.

If not provided, default value is `false`.

Parameters:
  `longQryExplain` - Flag marking SPI should print SQL execution plan for long queries (explain SQL query).
See Also:
  `setLongQueryExecutionTimeout(long)`

#### setUseOptimizedSerializer

    public void setUseOptimizedSerializer(boolean useOptimizedSerializer)

The flag indicating that serializer for H2 database will be set to Ignite's marshaller. This setting usually makes sense for offheap indexing only.

Default is `DFLT_USE_OPTIMIZED_SERIALIZER`.

Parameters:
  `useOptimizedSerializer` - Flag value.

#### isUseOptimizedSerializer

    public boolean isUseOptimizedSerializer()

The flag indicating that serializer for H2 database will be set to Ignite's marshaller. This setting usually makes sense for offheap indexing only.

Default is `DFLT_USE_OPTIMIZED_SERIALIZER`.

Returns:
  Flag value.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC3
Release Date | : March 24 2015