Added PRAGMAs

PRAGMA bdbsql_system_memory
PRAGMA bdbsql_vacuum_fillpercent
PRAGMA bdbsql_vacuum_pages
PRAGMA multiversion
PRAGMA snapshot_isolation
PRAGMA trickle
PRAGMA txn_bulk
Replication PRAGMAs

The following PRAGMAs are added in the Berkeley DB SQL interface.

PRAGMA bdbsql_error_file [filename]

Redirects internal Berkeley DB error messages to the named file. If a relative path is specified to [filename], then the path is interpreted as being relative to the current working directory.

If this PRAGMA is issued with no filename, then the current target for Berkeley DB error output is returned. By default, error messages are sent to STDERR.

This PRAGMA can be issued at any time; initial database access does not have to occur before this PRAGMA can be used.

PRAGMA bdbsql_system_memory

PRAGMA bdbsql_system_memory [base segment ID]

Queries or sets a flag that causes the database's shared resources to be created in system shared memory. By default the database's shared resources are created in file-backed shared memory.

If a [base segment ID] is specified, the shared resources will be created using X/Open style shared memory interfaces. The [base segment ID] will be used as the starting ID for shared resources used by the database. Use different [base segment ID] values for different databases. It is possible for multi-process applications to use a single database by specifying the same [base segment ID] to this PRAGMA. Each connection needs to set this PRAGMA.

This PRAGMA may be used to set a [base segment ID] only before the first table is created in the database.

PRAGMA bdbsql_vacuum_fillpercent

PRAGMA bdbsql_vacuum_fillpercent [= N]

Sets or reports the page full threshold. Any page in the database that is at or below this percentage full is considered for vacuuming when PRAGMA incremental_vacuum is enabled. The value is specified as a percentage between 1 and 100. By default, pages 85% full and below are considered for vacuuming.

PRAGMA bdbsql_vacuum_pages

PRAGMA bdbsql_vacuum_pages [= N]

Sets or reports the maximum number of pages to be returned to the file system from the free page list when incremental vacuuming is enabled. By default, up to 128 pages are removed from the free list.

Page vacuuming is controlled using PRAGMA auto_vacuum.

PRAGMA multiversion

PRAGMA multiversion

Controls whether Multiversion Concurrency Control (MVCC) is on or off. You can not use this PRAGMA at any time during your application's runtime after your database tables have been accessed.

For more information on MVCC and snapshot isolation, see Using Multiversion Concurrency Control

PRAGMA snapshot_isolation

PRAGMA snapshot_isolation

Controls whether snapshot isolation is turned on. This PRAGMA can be used at any time during your application's runtime after Multiversion Concurrency Control (MVCC) has been turned on.

For more information on MVCC and snapshot isolation, see Using Multiversion Concurrency Control

PRAGMA trickle

PRAGMA trickle [percent]

Ensures that at least the specified percentage of pages in the shared cache are clean. This can cause pages that have been modified to be flushed to disk.

The trickle functionality enables an application to ensure that a page is available for reading new information into the shared cache without waiting for a write operation to complete.

Specifying this PRAGMA without a percentage value causes the current trickle value to be displayed. Specify 0 to turn the trickle functionality off.

PRAGMA txn_bulk

PRAGMA TXN_BULK

Enables transactional bulk loading optimization. For more information, see Using Bulk Loading.

Replication PRAGMAs

Seven PRAGMAs were added to control replication. They are described in Using Replication with the SQL API:

Note

If you are using these replication PRAGMAs and you want to perform a backup, there is an additional backup step for the pragma file. See Backing Up Berkeley DB SQL Databases for more information.

  • PRAGMA replication

  • PRAGMA replication_initial_master

  • PRAGMA replication_local_site

  • PRAGMA replication_remote_site

  • PRAGMA replication_remove_site

  • PRAGMA replication_verbose_output

  • PRAGMA replication_verbose_file