summaryrefslogtreecommitdiffstats
path: root/database/sqlite/sqlite_aclk.c
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2023-08-30 15:29:21 +0300
committerGitHub <noreply@github.com>2023-08-30 15:29:21 +0300
commite3de1518c69b6e8fe40aa6b023c6932a385d08ed (patch)
tree786571f7f9171248c05bd5671a62523549f1af1f /database/sqlite/sqlite_aclk.c
parentdde4d49e01eaee8426bb2fc7028fcb003ffd2a1e (diff)
Add index to ACLK table to improve update statements (#15890)
* Add index to improve update statements * Add index to improve select statements * Improve update statement
Diffstat (limited to 'database/sqlite/sqlite_aclk.c')
-rw-r--r--database/sqlite/sqlite_aclk.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c
index fedce50eba..95127cbb55 100644
--- a/database/sqlite/sqlite_aclk.c
+++ b/database/sqlite/sqlite_aclk.c
@@ -499,6 +499,16 @@ void sql_create_aclk_table(RRDHOST *host __maybe_unused, uuid_t *host_uuid __may
rc = db_execute(db_meta, sql);
if (unlikely(rc))
error_report("Failed to create ACLK alert table index for host %s", host ? string2str(host->hostname) : host_guid);
+
+ snprintfz(sql, ACLK_SYNC_QUERY_SIZE -1, INDEX_ACLK_ALERT1, uuid_str, uuid_str);
+ rc = db_execute(db_meta, sql);
+ if (unlikely(rc))
+ error_report("Failed to create ACLK alert table index 1 for host %s", host ? string2str(host->hostname) : host_guid);
+
+ snprintfz(sql, ACLK_SYNC_QUERY_SIZE -1, INDEX_ACLK_ALERT2, uuid_str, uuid_str);
+ rc = db_execute(db_meta, sql);
+ if (unlikely(rc))
+ error_report("Failed to create ACLK alert table index 2 for host %s", host ? string2str(host->hostname) : host_guid);
}
if (likely(host) && unlikely(host->aclk_sync_host_config))
return;