To use Kùzu, you need to first create a
Database instance. The
Database class requires:
databasePath, which sets the path to the directory of your database;
SystemConfigobject, which sets the size of the buffer pool, and max num of threads.
To construct a Database instance, databasePath is mandatory. Currently, we do not support the in-memory mode, thus, each database must point to a directory in the file system.
By default, SystemConfig sets the max size of the buffer pool to 80% of the system physical memory and max num threads to
std::thread::hardware_concurrency();. You can set a customized max buffer pool size (e.g., several GBs) through the constructor of
SystemConfig. For example:
SystemConfig systemConfig(1ull << 31 /* set max buffer pool size to 2GB */); Database database("testdb", systemConfig); ...
By setting a buffer pool size to
x, Kùzu’ buffer pool is limited to use at most
x amount of memory. Instead of grabbing all of the memory at the initial startup, Kùzu grabs memory on demand, until hit the size.
Also: Do not construct multiple Database instances either within the same process or using multiple separate processes unless you will only issue read-only queries through the connections you create from these these Database instances. See this note for more details.
Database class is the main class of KùzuDB. It manages all database components.
Database (std::string databasePath)
Creates a database object at the given path with the default buffer pool size and max num threads.
Database (std::string databasePath, SystemConfig systemConfig)
Creates a database object at the given path with customized buffer pool size and max num threads.
systemConfigSystem configurations (buffer pool size and max num threads).
void setLoggingLevel (std::string loggingLevel)
Sets the logging level of the database instance.
loggingLevelNew logging level. (Supported logging levels are: ‘info’, ‘debug’, ‘err’).
Stores buffer pool size and max number of threads configurations.
SystemConfig (uint64_t bufferPoolSize)
Creates a SystemConfig object.
bufferPoolSizeBuffer pool size in bytes.