tirkarthi commented on issue #31340: URL: https://github.com/apache/airflow/issues/31340#issuecomment-1555021331
One possible assumption is that search fields created, changed, created_by and changed_by query User but don't need roles thus efficient when using select but the page needs to access roles for each user in the main table. Meanwhile if selectin is used then the main table is speed up but search with changed*, created* makes it slower which can be disabled. Also when page_size is 100 the result reverses since select causes every row to hit db and for 100 rows its efficient to have selectin that performs only 2 queries with user fetch and an in query to fetch roles. Rather than changing lazy loading method which could affect other parts like this I guess it's better to have search to exclude changed*, created* . ``` # lazy='selectin' In [5]: %timeit with create_session() as session: [user.roles for user in session.query(User).all()] 68.2 ms ± 8.4 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) # lazy='select' . Exclude created*, changed* fields and the render causes each entry In [4]: %timeit with create_session() as session: [user.roles for user in session.query(User).all()] 319 ms ± 4.07 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) ``` -- 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]
