@cryptotaxi247 / netdata-1 / commits / 16ad34d8d

chore: add links to SQLite init options in the src code (#12920)

Ilya Mashchenko committed May 16, 2022 at 19:21 UTC 16ad34d8d2e9631665187d857ac45a2561e0df4c
1 file changed +7 -1
database/sqlite/sqlite_functions.c
+7 -1
@@ -396,26 +396,32 @@ int sql_init_database(db_check_action_type_t rebuild, int memory)
396 char buf[1024 + 1] = "";
397 const char *list[2] = { buf, NULL };
398
399 + // https://www.sqlite.org/pragma.html#pragma_auto_vacuum
400 // PRAGMA schema.auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL;
401 snprintfz(buf, 1024, "PRAGMA auto_vacuum=%s;", config_get(CONFIG_SECTION_SQLITE, "auto vacuum", "INCREMENTAL"));
402 if(init_database_batch(rebuild, 0, list)) return 1;
403
404 + // https://www.sqlite.org/pragma.html#pragma_synchronous
405 // PRAGMA schema.synchronous = 0 | OFF | 1 | NORMAL | 2 | FULL | 3 | EXTRA;
406 snprintfz(buf, 1024, "PRAGMA synchronous=%s;", config_get(CONFIG_SECTION_SQLITE, "synchronous", "NORMAL"));
407 if(init_database_batch(rebuild, 0, list)) return 1;
408
409 + // https://www.sqlite.org/pragma.html#pragma_journal_mode
410 // PRAGMA schema.journal_mode = DELETE | TRUNCATE | PERSIST | MEMORY | WAL | OFF
411 snprintfz(buf, 1024, "PRAGMA journal_mode=%s;", config_get(CONFIG_SECTION_SQLITE, "journal mode", "WAL"));
412 if(init_database_batch(rebuild, 0, list)) return 1;
413
414 + // https://www.sqlite.org/pragma.html#pragma_temp_store
415 // PRAGMA temp_store = 0 | DEFAULT | 1 | FILE | 2 | MEMORY;
416 snprintfz(buf, 1024, "PRAGMA temp_store=%s;", config_get(CONFIG_SECTION_SQLITE, "temp store", "MEMORY"));
417 if(init_database_batch(rebuild, 0, list)) return 1;
414 -
418 +
419 + // https://www.sqlite.org/pragma.html#pragma_journal_size_limit
420 // PRAGMA schema.journal_size_limit = N ;
421 snprintfz(buf, 1024, "PRAGMA journal_size_limit=%lld;", config_get_number(CONFIG_SECTION_SQLITE, "journal size limit", 16777216));
422 if(init_database_batch(rebuild, 0, list)) return 1;
423
424 + // https://www.sqlite.org/pragma.html#pragma_cache_size
425 // PRAGMA schema.cache_size = pages;
426 // PRAGMA schema.cache_size = -kibibytes;
427 snprintfz(buf, 1024, "PRAGMA cache_size=%lld;", config_get_number(CONFIG_SECTION_SQLITE, "cache size", -2000));