All Products
Search
Document Center

PolarDB:Search

Last Updated:Jul 21, 2023

The search feature is used to query SQL statements and export related information such as the databases on which the SQL statements are executed, the status of the SQL requests, and the execution duration of each SQL statement. This topic describes how to use the search feature.

Prerequisites

Procedure

  1. Log on to the PolarDB for Xscale console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. On the Instances page, click the PolarDB-X 2.0 tab.
  4. Find the target instance and click its ID.
  5. In the left-side navigation pane, choose Diagnosis and optimization > SQL Insight and Stress Testing (New Version).
    Note You can click Service Settings to specify the retention period of SQL logs.
  6. On the page that appears, click the Search tab and specify query conditions. The following table describes the parameters that you can specify as query conditions.
    ParameterDescription
    Time Range

    Specify the time range during which the SQL statements executed are queried.

    The maximum time range that is allowed for an online query is 24 hours. This is because the SQL Explorer feature logs a large number of SQL statements. These logs can be used to trace all operations that are performed on your database instance. If the time range for an online query exceeds 24 hours, the query can take an extended period of time to run and may even time out.
    Note If you want to query SQL statements over a time range that exceeds 24 hours, we recommend that you asynchronously export SQL logs as a file and download the file to your on-premises machine.
    KeywordYou can specify multiple keywords. Fuzzy queries are not supported. Multiple keywords must be separated by spaces.
    Note Each keyword must contain at least four characters.
    UserYou can specify multiple usernames that are separated by spaces. Example: user1 user2 user3.
    DatabaseYou can specify multiple database names that are separated by spaces. Example: DB1 DB2 DB3.
    Operation TypeSelect the operation types that you want to query. You can select one or more operation types.
    Note You can click Enable Advanced Query to specify more parameters to further refine the query.
  7. Click Query. Then, you can view the information about queried SQL statements in the Logs section.
    Note
    • You can click Export to export the logs. In the Export SQL Records dialog box, you can select the fields that you want to export from Exported Fields. You can configure the Export Time Range parameter to export information about SQL statements within longer time ranges.
    • You can click View Exported Logs to view recent export tasks.