tirkarthi commented on issue #33647:
URL: https://github.com/apache/airflow/issues/33647#issuecomment-1846989815

   @shubhransh-eb Can you please add the previous version of Airflow where it 
worked fine? We upgraded from Airflow 2.3.4 to 2.7.2. We are also using mysql 8 
and faced the query taking a long time even with 1 trigger running entry in one 
of the environments where db migration was done in place and has lot of records 
in other tables. In the other environment db migration was done on a backup and 
restored database with less records. We found that by trial and error to making 
dag_run to load lazily helped triggerer process to run fine though list trigger 
page in UI still hangs on trying to use it with active triggers. It loads fine 
without lazy loading when there is no trigger though. I am not sure if its 
relevant to you but the query mentioned in the issue description was the same 
in our case taking long time and thought to add it here.
   
   
https://github.com/apache/airflow/blob/4824ca7c5a1e532ae19899f4b0d48c3216c7c871/airflow/models/trigger.py#L99-L110
   
   Lazy load dag_run
   
   ```python
       def bulk_fetch(cls, ids: Iterable[int], session: Session = NEW_SESSION) 
-> dict[int, Trigger]:
           """Fetch all the Triggers by ID and return a dict mapping ID -> 
Trigger instance."""
           query = session.scalars(
               select(cls)
               .where(cls.id.in_(ids))
               .options(
                   joinedload("task_instance").lazyload("dag_run"),
                   joinedload("task_instance.trigger"),
                   joinedload("task_instance.trigger.triggerer_job"),
               )
           )
           return {obj.id: obj for obj in query}
   ```


-- 
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