Skip to main content





Trace Executed Queries Back to Your OutSystems Applications

  • Edit
    Collaborate with us
    Edit this page on GitHub
  • This feature is only available in OutSystems on-premises installations.

    When your Database Administrator (DBA) is troubleshooting performance issues in a query generated by OutSystems, it might be challenging to pinpoint the exact origin of the query, namely the exact OutSystems module and action/screen.

    OutSystems allows you to add information about the query origin to the SQL query statement, making this information visible in the database tools that your DBA already uses. This way, the DBA can inform OutSystems developers of the exact location of an underperforming query.

    This information is available for platform-generated queries of both Aggregates and SQL elements. This feature is disabled by default, and you can activate it using Factory Configuration.

    The comment mentioning the query origin contains the following information:


    For example:

    /* EmployeeManager.EmployeeFlow.EmployeeList.Preparation.GetEmployees */

    From the information in the comment (first line of the example), you know that this query is generated in the "EmployeeManager" module, in the "EmployeeFlow" UI flow, in the "EmployeeList" screen, in the screen preparation, and from the "GetEmployees" entity action.

    Note: Activating this feature doesn't have an impact on query performance. However, the query plan might need to be recalculated, which means that there might be an initial performance penalty until the query plan stabilizes.

    Enable the query origin information in generated SQL

    You can enable this feature in Factory Configuration. Make sure you install this Forge component before proceeding.

    Do the following:

    1. Go to the Factory Configuration application (https://<environment_name>/FactoryConfiguration).

    2. Enable the Add Query Origin to Generated SQL setting under "Publish".

    3. Click Apply.

    4. Publish the modules where you wish to have query origin information.
      Alternatively, publish a solution containing all modules using Service Center, so that this change is applied to all modules in the environment.

    • Was this article helpful?