EnxDev commented on code in PR #43990:
URL: https://github.com/apache/superset/pull/43990#discussion_r4087723874
##########
superset/daos/dashboard.py:
##########
@@ -203,6 +208,37 @@ def get_by_id_or_slug(cls, id_or_slug: int | str) ->
Dashboard:
return dashboard
+ @staticmethod
+ def prefetch_chart_access(dashboard: Dashboard) -> None:
+ """
+ Load the editors and viewers of a dashboard's charts up front.
+
+ The per-chart access check reads both on every slice, so without this
+ they are two lazy loads per chart rather than two queries in total.
Review Comment:
The editor and viewer paths still grow with chart count after this.
`is_editor` and `is_viewer` each call `get_user_subject_ids`, which runs a
query on every call, and that's the one-per-chart left in your first table (11,
26, 46 for editors, two per chart for viewers).
Fine to leave it for the follow-up you mentioned, but could the description
say so next to the `can_access_datasource` caveat? Caching the subject ids for
the request would make both paths flat.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]