$smwgQueryProfiler

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgQueryProfiler
Description Sets whether specific monitorable profile data are recorded
Default setting
[]
Software Semantic MediaWiki
Since version
Until version still available
Configuration Installation
Keyword monitoring · profiling


$smwgQueryProfiler is a configuration parameter that sets whether specific monitorable profile data for queries such as query duration and query parameters are recorded or not. The configuration parameter was introduced in Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x..1 Starting with Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x. an additional option to record query parameters is available.2

Starting with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. this parameter accepts plain string keys ('duration', 'parameters') instead of the SMW_QPRFL_* constants, and its default changes from true to [] with no change in behaviour. The constant form and the boolean true form still work but are deprecated and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki..3

Default setting[edit]

$smwgQueryProfiler = [];

This means that query profiling is enabled for Query size, Query depth, Query format, Query string and Query scode (status code), but none of the additional detail fields described below are recorded.

An empty array [] enables basic profiling; it does not disable it. To switch query profiling off entirely, set the parameter to false.

Available options[edit]

The following detail-field keys can be listed in the array to record additional profile data:

  • 'duration' (formerly SMW_QPRFL_DUR) – Allows recording the query duration (the time between the query result selection and its output) / since Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x.
  • 'parameters' (formerly SMW_QPRFL_PARAMS) – Allows recording the query parameters (the parameters like limits and sorting influencing on how and which results are selected for the output) / since Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x.
The option strings were introduced in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x., replacing the earlier constant names. As of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. the SMW_QPRFL_* constants are deprecated and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki..

Changing the default setting[edit]

If you change the setting for this configuration parameter, please ensure to run maintenance script "setupStore.php"Allows to set up the data backend/store followed by maintenance script "rebuildData.php"Allows to rebuild all the semantic data for a selected data backend/store.

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

Enable the recording of query duration
$smwgQueryProfiler = [ 'duration' ];
Enable the recording of query parameters
$smwgQueryProfiler = [ 'parameters' ];
Enable the recording of query duration and query parameters
$smwgQueryProfiler = [ 'duration', 'parameters' ];
Disable all query profiling from being recorded
$smwgQueryProfiler = false;
This setting is not recommended since the disabled functionality may impact secondary processes that rely on profile information to be available (notification system etc.).

Legacy constant form (deprecated since 7.0.0)[edit]

The constant form below is deprecated since Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.. Use the string-array form shown above instead. It is documented here for wikis still running the constant form.
$smwgQueryProfiler = SMW_QPRFL_DUR | SMW_QPRFL_PARAMS;

Version history[edit]

This configuration parameter underwent a major change in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. aiming at simplifying the setup.4 See this version of the documentation available for releases prior to Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:30
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:2270
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:6805
  4. ^  Semantic MediaWiki: GitHub pull request gh:smw:2732