To create or open a persistent database, the application ...
Parameter Settings
Please refer to the general guidelines discussed in the Creating Databases page for determining the proper values for
MemPageSize,DiskPageSize,MaxConnections,MaxDiskDatabaseSizeandLogType.Log Type and Transaction Commit Policy
Applications set the
DatabaseParameters.LogTypetoRedoLog, UndoLogorNoLogfor the Database methodopen(). Depending on the log type selected, the additional Database.Parameters propertyRedoLogLimitorDelayedCommitThresholdcan be set. (Please see the Persistent Database I/O page for detailed explanations.)Note that if the
NoLoglog type is selected, the application can explicitly force the cache to be flushed to the media with the Connection methoddiskFlush().Memory Device Specification
As explained in the Python memory devices page, applications using persistent databases must specify at least four memory devices:
- dictionary and metadata, and possible transient class data: a private or shared memory device
- persistent data storage: a file, multifile or raid device
- persistent data cache: a private or shared memory device
- transaction log: a file, multifile or raid device
To specify these devices, the application instantiates a tuple of devices and passes this to the
open_database()call. For example, the following code snippet defines memory for an in-memory or persistent database, then creates the database:if self.disk: devices = (self.exdb.fileDevice(self.exdb.Device.Data, "open_db.dbs"), self.exdb.fileDevice(self.exdb.Device.TransactionLog, "open_db.log"), self.exdb.privateMemoryDevice(self.exdb.Device.Data, 4*1024*1024), self.exdb.privateMemoryDevice(self.exdb.Device.DiskCache, 16*1024*1024) ) else: devices = ( self.exdb.privateMemoryDevice(self.exdb.Device.Data, 4 * 1024*1024), ) self.db = self.exdb.open_database(dbname='opendb', dictionary=dict, is_disk=self.disk, devices=devices);Note that in order to open an existing persistent database, the application must specify the same
open_database()parameters that were used to create the database.