hussein-awala commented on code in PR #75216:
URL: https://github.com/apache/airflow/pull/75216#discussion_r4411977863


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/pools.py:
##########
@@ -119,10 +140,16 @@ def get_pools(
         session=session,
     )
 
-    pools = session.scalars(pools_select)
+    pools = session.scalars(pools_select).all()
+    pool_stats = Pool.slots_stats(session=session)

Review Comment:
   Could we restrict the bulk statistics to the pool names in the returned 
page, and skip aggregation when the page is empty?
   
   `Pool.slots_stats()` aggregates task instances across every pool, regardless 
of the pagination and filters applied above. Searching for one idle pool—or 
getting no results—therefore scans unrelated workloads, whereas the previous 
queries used indexed pool-specific predicates. The UI uses both pagination and 
name filters, so this can regress those requests on large installations.
   
   Scoping the aggregation to the selected pools would preserve the constant 
query count without introducing that extra work. The current query-count test 
won’t catch this because it only creates empty pools.



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