Skip to content

Commit

Permalink
Change: Improve init_preference_iterator SQL query performance
Browse files Browse the repository at this point in the history
Merge pull request #1768 from falegk/improve-init-preference-iterator
  • Loading branch information
timopollmeier authored Dec 20, 2021
2 parents af80abb + 29169ec commit 5a5cbb9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/manage_sql_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3421,15 +3421,14 @@ init_preference_iterator (iterator_t* iterator,
" UNION"
" SELECT nvt_preferences.name, nvt_preferences.value"
" FROM nvt_preferences"
" WHERE nvt_preferences.name %s"
" AND (SELECT COUNT(*) FROM config_preferences"
" WHERE config = %llu"
" AND config_preferences.name = nvt_preferences.name) = 0;",
" LEFT JOIN config_preferences"
" ON config_preferences.config = %llu AND config_preferences.name = nvt_preferences.name"
" WHERE config_preferences.id IS NULL AND nvt_preferences.name %s",
config,
quoted_section,
config,
strcmp (quoted_section, "SERVER_PREFS") == 0
? "NOT LIKE '%:%:%:%'" : "LIKE '%:%:%:%'",
config);
? "NOT LIKE '%:%:%:%'" : "LIKE '%:%:%:%'");
g_free (quoted_section);
}

Expand Down

0 comments on commit 5a5cbb9

Please sign in to comment.