dosubot[bot] commented on issue #30172:
URL: https://github.com/apache/superset/issues/30172#issuecomment-2332707245

   <!-- Answer -->
   The `query` table needs the following indexes to optimize performance:
   
   1. Index on the `results_key` column:
       ```python
       op.create_index(
           op.f("ix_query_results_key"), "query", ["results_key"], unique=False
       )
       ```
   
   2. Index on the combination of `user_id` and `changed_on` columns:
       ```python
       op.create_index(
           op.f("ti_user_id_changed_on"), "query", ["user_id", "changed_on"], 
unique=False
       )
       ```
   
   3. Index on the `sql_editor_id` column:
       ```python
       op.create_index(
           op.f("ix_query_sql_editor_id"), "query", ["sql_editor_id"], 
unique=False
       )
       ```
   
   These indexes should help improve the performance of queries on the `query` 
table 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/migrations/versions/2017-01-24_12-40_f18570e03440_add_query_result_key_index.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/migrations/versions/2016-07-25_17-48_ad82a75afd82_add_query_model.py)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/migrations/versions/2024-05-02_13-40_3dfd0e78650e_add_query_sql_editor_id_index.py)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to