Database
To create a database, new database name should be set to db control namespace. If no database exists, it will be created automatically.
Database can be created, opened or deleted only before environment startup.
name | type | description |
---|---|---|
db.name.name | string, ro | Get database name |
db.name.id | int | Database's sequential id number. This number is used in the transaction log for the database identification. |
db.name.path | string | Set folder to store database data. If variable is not set, it will be automatically set as **sophia.path/database_name**. |
db.name.mmap | int | Enable or disable mmap mode. |
db.name.direct_io | int | Enable or disable O_DIRECT mode. |
db.name.sync | int | Sync node file on compaction completion. |
db.name.expire | int | Enable or disable key expire. |
db.name.compression | string | Specify compression driver. Supported: lz4, zstd, none (default). |
db.name.comparator | function | Set custom comparator function (example: [comparator.c](https://github.com/pmwkaa/sophia/blob/master/example/comparator.c)). |
db.name.comparator_arg | string | Set custom comparator function arg. |
db.name.upsert | function | Set upsert callback function (example: [upsert.c](https://github.com/pmwkaa/sophia/blob/master/example/upsert.c). |
db.name.upsert_arg | string | Set upsert function argument. |
db.name.limit.key | int, ro | Scheme key size limit. |
db.name.limit.field | int | Scheme field size limit. |
db.name.index.memory_used | int, ro | Memory used by database for in-memory key indexes in bytes. |
db.name.index.size | int, ro | Sum of nodes size in bytes (compressed). This is equal to the full database size. |
db.name.index.size_uncompressed | int, ro | Full database size before the compression. |
db.name.index.count | int, ro | Total number of keys stored in database. This includes transactional duplicates and not yet-merged duplicates. |
db.name.index.count_dup | int, ro | Total number of transactional duplicates. |
db.name.index.read_disk | int, ro | Number of disk reads since start. |
db.name.index.read_cache | int, ro | Number of cache reads since start. |
db.name.index.node_count | int, ro | Number of active nodes. |
db.name.index.page_count | int, ro | Total number of pages. |