Updated on 2025-05-20 GMT+08:00

Setting SET Statements

Using SET statements to configure query hints is a method to manually optimize query performance. This approach can directly influence the decisions of the database query optimizer, thereby improving database query performance. Once SET statements are configured, query efficiency will be enhanced in scenarios such as dashboards and large screens. This section describes how to set SET statements.

Notes and Constraints

  • The currently supported data sources for SET statements are: GaussDB(DWS) and PostgreSQL.
  • The parameter name of the SET statement can only contain letters, numbers, periods (.), and underscores (_), with a maximum length of 50 characters.
  • A maximum of 10 SET statements can be added.

Prerequisites

Procedure

  1. Log in to the DataArts Insight console.
  2. Click in the upper left corner of the management console to select a region. Then, select an enterprise project in the upper right corner.
  3. On the top menu of the console, click Project. On the displayed My Projects page, click the name of the desired project.
  4. In the navigation pane on the left, choose Data Management > Datasets.
  5. On the displayed page, click the name of the dataset you created.
  6. On the dataset editing page, click Set up the SET statement (Figure 1).
    Figure 1 Setting the SET statement

  7. In the dialog box that appears, set the parameters, click Validate, and click OK. Figure 1 lists the join_collapse_limit and from_collapse_limit parameters for the PostgreSQL database. For other parameters and their descriptions, refer to the official documentation. After setting up, click View SQL Statement to view the configured SET statements (Figure 2).
    Figure 2 Viewing SQL statements

    Once SET statements are configured, when performing data analysis on the dashboard, click in the upper right corner of the chart and select View SQL Statement to view the configured SET statements.