## org.h2.constant
Class DbSettings

    java.lang.Object
      org.h2.engine.SettingsBase
          org.h2.constant.DbSettings

    public class DbSettings

extends SettingsBase

This class contains various database-level settings. To override the documented default value for a database, append the setting in the database URL: "jdbc:h2:test;ALIAS_COLUMN_NAME=TRUE" when opening the first connection to the database. The settings can not be changed once the database is open.

Some settings are a last resort and temporary solution to work around a problem in the application or database engine. Also, there are system properties to enable features that are not yet fully tested or that are not backward compatible.

Field Summary
`boolean` `aliasColumnName` Database setting `ALIAS_COLUMN_NAME` (default: false). When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the alias (I in this case) in ResultSetMetaData.getColumnName() and 'null' in getTableName().
`int` `analyzeAuto` Database setting `ANALYZE_AUTO` (default: 2000). After changing this many rows, ANALYZE is automatically run for a table.
`int` `analyzeSample` Database setting `ANALYZE_SAMPLE` (default: 10000). The default sample size when analyzing a table.
`boolean` `databaseToUpper` Database setting `DATABASE_TO_UPPER` (default: true). Database short names are converted to uppercase for the DATABASE() function, and in the CATALOG column of all database meta data methods.
`boolean` `dbCloseOnExit` Database setting `DB_CLOSE_ON_EXIT` (default: true). Close the database when the virtual machine exits normally, using a shutdown hook.
`boolean` `defaultConnection` Database setting `DEFAULT_CONNECTION` (default: false). Whether Java functions can use `DriverManager.getConnection("jdbc:default:connection")` to get a database connection.
`java.lang.String` `defaultEscape` Database setting `DEFAULT_ESCAPE` (default: \). The default escape character for LIKE comparisons.
`java.lang.String` `defaultTableEngine` Database setting `DEFAULT_TABLE_ENGINE` (default: null). The default table engine to use for new tables.
`boolean` `defragAlways` Database setting `DEFRAG_ALWAYS` (default: false). Each time the database is closed, it is fully defragmented (SHUTDOWN DEFRAG).
`boolean` `dropRestrict` Database setting `DROP_RESTRICT` (default: true). Whether the default action for DROP TABLE and DROP VIEW is RESTRICT.
`boolean` `earlyFilter` Database setting `EARLY_FILTER` (default: false). This setting allows table implementations to apply filter conditions early on.
`int` `estimatedFunctionTableRows` Database setting `ESTIMATED_FUNCTION_TABLE_ROWS` (default: 1000). The estimated number of rows in a function table (for example, CSVREAD or FTL_SEARCH).
`boolean` `functionsInSchema` Database setting `FUNCTIONS_IN_SCHEMA` (default: true). If set, all functions are stored in a schema.
`int` `largeResultBufferSize` Database setting `LARGE_RESULT_BUFFER_SIZE` (default: 4096). Buffer size for large result sets.
`boolean` `largeTransactions` Database setting `LARGE_TRANSACTIONS` (default: true). Support very large transactions
`int` `maxCompactCount` Database setting `MAX_COMPACT_COUNT` (default: Integer.MAX_VALUE). The maximum number of pages to move when closing a database.
`int` `maxCompactTime` Database setting `MAX_COMPACT_TIME` (default: 200). The maximum time in milliseconds used to compact a database when closing.
`int` `maxMemoryRowsDistinct` Database setting `MAX_MEMORY_ROWS_DISTINCT` (default: 10000). The maximum number of rows kept in-memory for SELECT DISTINCT queries.
`int` `maxQueryTimeout` Database setting `MAX_QUERY_TIMEOUT` (default: 0). The maximum timeout of a query in milliseconds.
`boolean` `nestedJoins` Database setting `NESTED_JOINS` (default: true). Whether nested joins should be supported.
`boolean` `optimizeDistinct` Database setting `OPTIMIZE_DISTINCT` (default: true). Improve the performance of simple DISTINCT queries if an index is available for the given column.
`boolean` `optimizeEvaluatableSubqueries` Database setting `OPTIMIZE_EVALUATABLE_SUBQUERIES` (default: true). Optimize subqueries that are not dependent on the outer query.
`boolean` `optimizeInList` Database setting `OPTIMIZE_IN_LIST` (default: true). Optimize IN(...) and IN(SELECT ...) comparisons.
`boolean` `optimizeInSelect` Database setting `OPTIMIZE_IN_SELECT` (default: true). Optimize IN(SELECT ...) comparisons.
`boolean` `optimizeInsertFromSelect` Database setting `OPTIMIZE_INSERT_FROM_SELECT` (default: true). Insert into table from query directly bypassing temporary disk storage.
`boolean` `optimizeIsNull` Database setting `OPTIMIZE_IS_NULL` (default: false). Use an index for condition of the form columnName IS NULL.
`boolean` `optimizeOr` Database setting `OPTIMIZE_OR` (default: true). Convert (C=? OR C=?) to (C IN(?, ?)).
`boolean` `optimizeTwoEquals` Database setting `OPTIMIZE_TWO_EQUALS` (default: true). Optimize expressions of the form A=B AND B=1.
`boolean` `optimizeUpdate` Database setting `OPTIMIZE_UPDATE` (default: true). Speed up inserts, updates, and deletes by not reading all rows from a page unless necessary.
`boolean` `pageStoreInternalCount` Database setting `PAGE_STORE_INTERNAL_COUNT` (default: false). Update the row counts on a node level.
`int` `pageStoreMaxGrowth` Database setting `PAGE_STORE_MAX_GROWTH` (default: 128 * 1024). The maximum number of pages the file grows at any time.
`boolean` `pageStoreTrim` Database setting `PAGE_STORE_TRIM` (default: true). Trim the database size when closing.
`int` `queryCacheSize` Database setting `QUERY_CACHE_SIZE` (default: 8). The size of the query cache, in number of cached statements.
`boolean` `recompileAlways` Database setting `RECOMPILE_ALWAYS` (default: false). Always recompile prepared statements.
`int` `reconnectCheckDelay` Database setting `RECONNECT_CHECK_DELAY` (default: 200). Check the .lock.db file every this many milliseconds to detect that the database was changed.
`boolean` `rowId` Database setting `ROWID` (default: true). If set, each table has a pseudo-column _ROWID_.
`boolean` `selectForUpdateMvcc` Database setting `SELECT_FOR_UPDATE_MVCC` (default: true). If set, SELECT ..
`boolean` `shareLinkedConnections` Database setting `SHARE_LINKED_CONNECTIONS` (default: true). Linked connections should be shared, that means connections to the same database should be used for all linked tables that connect to the same database.

Method Summary
`static DbSettings` `getInstance(java.util.HashMap<java.lang.String,java.lang.String> s)` INTERNAL.

Methods inherited from class org.h2.engine.SettingsBase
`containsKey, get, get, get, getSettings`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### aliasColumnName

    public final boolean aliasColumnName

  Database setting `ALIAS_COLUMN_NAME` (default: false).
  When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the alias (I in this case) in ResultSetMetaData.getColumnName() and 'null' in getTableName(). If disabled, the real column name (ID in this case) and table name is returned.
  This setting only affects the default and the MySQL mode. When using any other mode, this feature is enabled for compatibility, even if this database setting is not enabled explicitly.

### analyzeAuto

    public final int analyzeAuto

  Database setting `ANALYZE_AUTO` (default: 2000).
  After changing this many rows, ANALYZE is automatically run for a table. Automatically running ANALYZE is disabled if set to 0. If set to 1000, then ANALYZE will run against each user table after about 1000 changes to that table. The time between running ANALYZE doubles each time since starting the database. It is not run on local temporary tables, and tables that have a trigger on SELECT.

### analyzeSample

    public final int analyzeSample

  Database setting `ANALYZE_SAMPLE` (default: 10000).
  The default sample size when analyzing a table.

### databaseToUpper

    public final boolean databaseToUpper

  Database setting `DATABASE_TO_UPPER` (default: true).
  Database short names are converted to uppercase for the DATABASE() function, and in the CATALOG column of all database meta data methods. Setting this to "false" is experimental. When set to false, all identifier names (table names, column names) are case sensitive (except aggregate, built-in functions, data types, and keywords).

### dbCloseOnExit

    public final boolean dbCloseOnExit

  Database setting `DB_CLOSE_ON_EXIT` (default: true).
  Close the database when the virtual machine exits normally, using a shutdown hook.

### defaultConnection

    public boolean defaultConnection

  Database setting `DEFAULT_CONNECTION` (default: false).
  Whether Java functions can use `DriverManager.getConnection("jdbc:default:connection")` to get a database connection. This feature is disabled by default for performance reasons. Please note the Oracle JDBC driver will try to resolve this database URL if it is loaded before the H2 driver.

### defaultEscape

    public final java.lang.String defaultEscape

  Database setting `DEFAULT_ESCAPE` (default: \).
  The default escape character for LIKE comparisons. To select no escape character, use an empty string.

### defragAlways

    public final boolean defragAlways

  Database setting `DEFRAG_ALWAYS` (default: false).
  Each time the database is closed, it is fully defragmented (SHUTDOWN DEFRAG).

### dropRestrict

    public final boolean dropRestrict

  Database setting `DROP_RESTRICT` (default: true).
  Whether the default action for DROP TABLE and DROP VIEW is RESTRICT.

### earlyFilter

    public final boolean earlyFilter

  Database setting `EARLY_FILTER` (default: false).
  This setting allows table implementations to apply filter conditions early on.

### estimatedFunctionTableRows

    public final int estimatedFunctionTableRows

  Database setting `ESTIMATED_FUNCTION_TABLE_ROWS` (default: 1000).
  The estimated number of rows in a function table (for example, CSVREAD or FTL_SEARCH). This value is used by the optimizer.

### functionsInSchema

    public final boolean functionsInSchema

  Database setting `FUNCTIONS_IN_SCHEMA` (default: true).
  If set, all functions are stored in a schema. Specially, the SCRIPT statement will always include the schema name in the CREATE ALIAS statement. This is not backward compatible with H2 versions 1.2.134 and older.

### largeResultBufferSize

    public final int largeResultBufferSize

  Database setting `LARGE_RESULT_BUFFER_SIZE` (default: 4096).
  Buffer size for large result sets. Set this value to 0 to disable the buffer.

### largeTransactions

    public final boolean largeTransactions

  Database setting `LARGE_TRANSACTIONS` (default: true).
  Support very large transactions

### maxCompactCount

    public final int maxCompactCount

  Database setting `MAX_COMPACT_COUNT` (default: Integer.MAX_VALUE).
  The maximum number of pages to move when closing a database.

### maxCompactTime

    public final int maxCompactTime

  Database setting `MAX_COMPACT_TIME` (default: 200).
  The maximum time in milliseconds used to compact a database when closing.

### maxMemoryRowsDistinct

    public final int maxMemoryRowsDistinct

  Database setting `MAX_MEMORY_ROWS_DISTINCT` (default: 10000).
  The maximum number of rows kept in-memory for SELECT DISTINCT queries. If more than this number of rows are in a result set, a temporary table is used.

### maxQueryTimeout

    public int maxQueryTimeout

  Database setting `MAX_QUERY_TIMEOUT` (default: 0).
  The maximum timeout of a query in milliseconds. The default is 0, meaning no limit. Please note the actual query timeout may be set to a lower value.

### nestedJoins

    public final boolean nestedJoins

  Database setting `NESTED_JOINS` (default: true).
  Whether nested joins should be supported.

### optimizeDistinct

    public final boolean optimizeDistinct

  Database setting `OPTIMIZE_DISTINCT` (default: true).
  Improve the performance of simple DISTINCT queries if an index is available for the given column. The optimization is used if:
  - The select is a single column query without condition
  - The query contains only one table, and no group by
  - There is only one table involved
  - There is an ascending index on the column
  - The selectivity of the column is below 20

### optimizeEvaluatableSubqueries

    public final boolean optimizeEvaluatableSubqueries

  Database setting `OPTIMIZE_EVALUATABLE_SUBQUERIES` (default: true).
  Optimize subqueries that are not dependent on the outer query.

### optimizeInsertFromSelect

    public final boolean optimizeInsertFromSelect

  Database setting `OPTIMIZE_INSERT_FROM_SELECT` (default: true).
  Insert into table from query directly bypassing temporary disk storage. This also applies to create table as select.

### optimizeInList

    public final boolean optimizeInList

  Database setting `OPTIMIZE_IN_LIST` (default: true).
  Optimize IN(...) and IN(SELECT ...) comparisons. This includes optimization for SELECT, DELETE, and UPDATE.

### optimizeInSelect

    public final boolean optimizeInSelect

  Database setting `OPTIMIZE_IN_SELECT` (default: true).
  Optimize IN(SELECT ...) comparisons. This includes optimization for SELECT, DELETE, and UPDATE.

### optimizeIsNull

    public final boolean optimizeIsNull

  Database setting `OPTIMIZE_IS_NULL` (default: false).
  Use an index for condition of the form columnName IS NULL.

### optimizeOr

    public final boolean optimizeOr

  Database setting `OPTIMIZE_OR` (default: true).
  Convert (C=? OR C=?) to (C IN(?, ?)).

### optimizeTwoEquals

    public final boolean optimizeTwoEquals

  Database setting `OPTIMIZE_TWO_EQUALS` (default: true).
  Optimize expressions of the form A=B AND B=1. In this case, AND A=1 is added so an index on A can be used.

### optimizeUpdate

    public final boolean optimizeUpdate

  Database setting `OPTIMIZE_UPDATE` (default: true).
  Speed up inserts, updates, and deletes by not reading all rows from a page unless necessary.

### pageStoreMaxGrowth

    public final int pageStoreMaxGrowth

  Database setting `PAGE_STORE_MAX_GROWTH` (default: 128 * 1024).
  The maximum number of pages the file grows at any time.

### pageStoreInternalCount

    public final boolean pageStoreInternalCount

  Database setting `PAGE_STORE_INTERNAL_COUNT` (default: false).
  Update the row counts on a node level.

### pageStoreTrim

    public final boolean pageStoreTrim

  Database setting `PAGE_STORE_TRIM` (default: true).
  Trim the database size when closing.

### queryCacheSize

    public final int queryCacheSize

  Database setting `QUERY_CACHE_SIZE` (default: 8).
  The size of the query cache, in number of cached statements. Each session has it's own cache with the given size. The cache is only used if the SQL statement and all parameters match. Only the last returned result per query is cached. Only SELECT statements are cached (excluding UNION and FOR UPDATE statements). This works for both statements and prepared statement.

### recompileAlways

    public final boolean recompileAlways

  Database setting `RECOMPILE_ALWAYS` (default: false).
  Always recompile prepared statements.

### reconnectCheckDelay

    public final int reconnectCheckDelay

  Database setting `RECONNECT_CHECK_DELAY` (default: 200).
  Check the .lock.db file every this many milliseconds to detect that the database was changed. The process writing to the database must first notify a change in the .lock.db file, then wait twice this many milliseconds before updating the database.

### rowId

    public final boolean rowId

  Database setting `ROWID` (default: true).
  If set, each table has a pseudo-column _ROWID_.

### selectForUpdateMvcc

    public final boolean selectForUpdateMvcc

  Database setting `SELECT_FOR_UPDATE_MVCC` (default: true).
  If set, SELECT .. FOR UPDATE queries lock only the selected rows when using MVCC.

### shareLinkedConnections

    public final boolean shareLinkedConnections

  Database setting `SHARE_LINKED_CONNECTIONS` (default: true).
  Linked connections should be shared, that means connections to the same database should be used for all linked tables that connect to the same database.

### defaultTableEngine

    public java.lang.String defaultTableEngine

  Database setting `DEFAULT_TABLE_ENGINE` (default: null).
  The default table engine to use for new tables.

Method Detail

### getInstance

    public static DbSettings getInstance(java.util.HashMap<java.lang.String,java.lang.String> s)

  INTERNAL. Get the settings for the given properties (may be null).

  Parameters:
    `s` - the settings
  Returns:
    the settings