Database Autonomy Service (DAS) provides the automatic SQL optimization feature that contains automatic index creation and deletion. The automatic index creation feature uses online data definition language (DDL) statements that are supported by the native MySQL kernel. This prevents table locking issues that may be caused by traditional indexing. This topic describes how to enable automatic index creation.

Prerequisites

  • An ApsaraDB RDS for MySQL instance of the High-availability or Enterprise Edition or a PolarDB for MySQL instance of the Cluster or Archive Database Edition is connected to DAS.
  • The Enable Autonomy Service switch is turned on for the database instance. For more information, see Autonomy center.
  • SQL Explorer is enabled for the database instance. For more information, see SQL Explorer.
    Note After the slow SQL statements are optimized, the overall performance may deteriorate. To improve the accuracy of the automatic SQL optimization feature, we recommend that you enable SQL Explorer.

Procedure

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring.
  3. Find the instance for which you want to enable automatic SQL optimization, and click the instance ID. The instance details page appears.
  4. In the left-side navigation pane, click Autonomy Center.
  5. On the Autonomy Center page, click Autonomy Service Settings in the upper-right corner.
    Autonomy Service Settings
  6. In the Settings dialog box, turn on the Enable Autonomy Service switch and select Enable Automatic Index Creation.
    Note You can enable the automatic index deletion feature to delete duplicate and unused indexes. However, this feature is unavailable.
  7. Click OK.