-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlowQuery add limit to find operation to improve performance (and dont slice in php) #4205
Comments
(this comes from @skurfuerst originally, I just turned it into an issue) Making FlowQuery operations even more clever makes me concerned because they already contain a lot of domain logic. a) defer fetching of nodes to the
|
Update: I think I completely misunterstood the issue and I somehow skipped this part:
While I think, this is a very useful performance optimization, it is IMO too low-level for the public Subgraph API. But maybe we can do this automatically in the Maybe we can extend |
Hi im not sure i understand correctly, but isnt this performance optimization already implemented in "find"? Lines 263 to 278 in 2b4e5b6
When there is only an instance of filters we translate the call directly to only fetch nodes of type x. edit i misunderstood - this is about the never ending story of having no "limit" option that affects the sql query in flow, but that we only slice in php - which is slower. first of all the |
The But this issue is about the internal behavior of the |
related (about performance) #4600 |
As exactly this topic just fell on a beta user knee (slack) i did some investigation. Now this is a very likely node structure
And in Neos 8 is was common practice to get the overview page via find
Or also the first blog entry
This is in Neos 9 tremendously slow. We advised in slack to use deterministic node aggregate ids (which is currently not really known for the end users) or to make the blog page tethered. Because fetching a named child node or the first child node gives a huge speedup:
Now similar to "b) introduce new operations that use the new Subgraph API" we discussed for several reasons to introduce new flow query operations, mainly because they are currently bloated and need to split up and because we wanted also to allow to use As outlined here i tested the flow-queries and using the subgraphs native pagination limiting to 1:
But my preliminary results were not promising. In fact there was no real difference noticeable. And that makes sense because the limiting only optimises only one thing so far: how many nodes are returned via sql. Now the node objects are all slim and there is little data to transfer so its not noticeable finding one or twenty blog pages and then discarding results. The real performance hit seems to be how we execute the sql query and that there is no optimisation for the limit 1 case. The current implementation of Lines 622 to 631 in f20b28c
The thesis is that there is no optimisation potential even for the limit=1 case in the database because the full tree was read in the database either way we just didnt return it fully. Now we discussed if we could leverage some kind of termination condition during the execution of the CTE to filter the nodes while we are descending and once there is a node found and its limit=1 we will simply not descend further. I attempted to implement a rough draft in #5436 which technically seems to work, but its benchmarks are not that promising so far/ BenchmarkThe following results where tested on a project with X nodes in a similar structure like above.
It seems that using the Further things we might need to benchmark and discuss:
|
//searchAction.targetNode = ${q(site).find('[instanceof Neos.DocsNeosIo:Document.SearchResultsPage]').get(0)}
is currently slow because it loads ALL nodes in a CTE; and then finds the FIRST SearchResultsPage.=> .find() could be more clever:
FindDescendantNodesFilter
and use this for the traversal step.The text was updated successfully, but these errors were encountered: