sortega opened a new issue, #60883:
URL: https://github.com/apache/airflow/issues/60883

   ### Description
   
   The `task_instance.dag_version_id` column was added in migration 
`0047_3_0_0_add_dag_versioning.py` but no index was created. This causes slow 
query performance when filtering/joining on this column.
   
   **Problem:**                                                                 
  
     - The column is a FK to `dag_version.id` and used to filter in some queries
     - Without an index, we get full table scans on `task_instance`     
                                                                                
           
   **Affected queries:**
     - UI grid endpoint filtering task instances by `dag_version_id`            
    
     - Any query joining `task_instance` with `dag_version`                     
 
                              
   **Proposed solution:**
     Add index `ti_dag_version_id` on `task_instance.dag_version_id`
   
   ### Use case/motivation
   
   We experienced query timeouts because of this issue in our Airflow 
deployment.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to