$smwgQUseLegacyQuery

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgQUseLegacyQuery
Description Sets whether the pre-7.0.0 query SQL shape should be used instead of the derived-table rewrite
Default setting
false
Software Semantic MediaWiki
Since version
Until version still available
Configuration Query performance
Keyword query · performance · sqlstore · mysql · mariadb


$smwgQUseLegacyQuery is a configuration parameter that sets whether Semantic MediaWiki should generate the pre-7.0.0 query SQL shape instead of the derived-table rewrite introduced in Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x.. The configuration parameter was introduced in Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x..1

Starting with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. the query engine rewrites #ask queries that sort by a property value as a derived-table subquery, which lets MariaDB and MySQL choose a more efficient plan and avoids the inefficient plans they tend to pick when DISTINCT and ORDER BY are combined. On large wikis the improvement can be orders of magnitude depending on query shape.

Default setting[edit]

$smwgQUseLegacyQuery = false;

This means that the derived-table query shape introduced in Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. is used.

Changing the default setting[edit]

To modify the setting to this configuration parameter, add the following line to your "LocalSettings.php" file:

Revert to the pre-7.0.0 query shape
$smwgQUseLegacyQuery = true;

This means that the previous SELECT DISTINCT query shape is used. Set this to true only if you encounter a query performance regression after upgrading and want to fall back while reporting the issue.

See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:6693