logic: improved performance of storing index to database
* add compiled statement for batch inserting 100 occurrences at once * removed unnecessary primary key from component_access to get rid of additional index table * changed explicit check for existing symbols when injecting to implicit check in insert statement (insert or ignore) * improved performance of adding edges by replacing edge multi part index with in-memory-index * added in-memory-index for node table * added in-memory-index for local_symbol table * added in-memory-index for lource_location table * moved setting storage mode to SqliteIndexStorage, because storage modes are not used anywhere else. * don't store current mode as member because re-creating an existing index takes no time. * add getter for name of SqliteDatabaseIndex * removed unused method from persistent storage
This commit is contained in:
@@ -16,8 +16,6 @@ SqliteStorage::SqliteStorage(const FilePath& dbFilePath)
|
||||
m_database.open(utility::encodeToUtf8(m_dbFilePath.wstr()).c_str());
|
||||
|
||||
executeStatement("PRAGMA foreign_keys=ON;");
|
||||
|
||||
m_mode = STORAGE_MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
SqliteStorage::~SqliteStorage()
|
||||
@@ -34,8 +32,6 @@ SqliteStorage::~SqliteStorage()
|
||||
|
||||
void SqliteStorage::setup()
|
||||
{
|
||||
m_indices = getIndices();
|
||||
|
||||
executeStatement("PRAGMA foreign_keys=ON;");
|
||||
setupMetaTable();
|
||||
|
||||
@@ -49,8 +45,6 @@ void SqliteStorage::setup()
|
||||
m_precompiledStatementsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_mode = STORAGE_MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
void SqliteStorage::clear()
|
||||
@@ -79,28 +73,6 @@ void SqliteStorage::setVersion(size_t version)
|
||||
insertOrUpdateMetaValue("storage_version", std::to_string(version));
|
||||
}
|
||||
|
||||
void SqliteStorage::setMode(const StorageModeType mode)
|
||||
{
|
||||
if (mode == m_mode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_indices.size(); i++)
|
||||
{
|
||||
if (m_indices[i].first & mode)
|
||||
{
|
||||
m_indices[i].second.createOnDatabase(m_database);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_indices[i].second.removeFromDatabase(m_database);
|
||||
}
|
||||
}
|
||||
|
||||
m_mode = mode;
|
||||
}
|
||||
|
||||
void SqliteStorage::beginTransaction()
|
||||
{
|
||||
executeStatement("BEGIN TRANSACTION;");
|
||||
|
||||
Reference in New Issue
Block a user