On a multilingual website, while reviewing the SQL queries done for a specific operation, we noticed that config table is getting requested twice for the same config names: once for default collection and once for the current language.
Examples:
SELECT name, data FROM config WHERE collection = 'language.en' AND name IN ( 'acq_sku_stock.settings' )
SELECT name, data FROM config WHERE collection = '' AND name IN ( 'acq_sku_stock.settings' )
SELECT name, data FROM config WHERE collection = 'language.en' AND name IN ( 'pathauto.pattern.content_pathauto', 'pathauto.pattern.department_page_path_pattern', 'pathauto.pattern.promotion_url_alias', 'pathauto.pattern.static_html_pattern', 'pathauto.pattern.store_arabic', 'pathauto.pattern.store_english' )
SELECT name, data FROM config WHERE collection = '' AND name IN ( 'pathauto.pattern.content_pathauto', 'pathauto.pattern.department_page_path_pattern', 'pathauto.pattern.promotion_url_alias', 'pathauto.pattern.static_html_pattern', 'pathauto.pattern.store_arabic', 'pathauto.pattern.store_english' )
SELECT name, data FROM config WHERE collection = 'language.en' AND name IN ( 'taxonomy.settings' )
SELECT name, data FROM config WHERE collection = '' AND name IN ( 'taxonomy.settings' )
SELECT name, data FROM config WHERE collection = 'language.en' AND name IN ( 'scheduled_updates.settings' )
SELECT name, data FROM config WHERE collection = '' AND name IN ( 'scheduled_updates.settings' )
SELECT name, data FROM config WHERE collection = 'language.en' AND name IN ( 'alshaya_acm_product_category.settings' )
SELECT name, data FROM config WHERE collection = '' AND name IN ( 'alshaya_acm_product_category.settings' )
One query is executed from Drupal\Core\Config\ConfigFactory::doLoadMultiple.
The other one is executed from Drupal\language\Config\LanguageConfigFactoryOverride::loadOverrides.
Would it make sense to merge these two queries into a single one?