Skip to content
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

The recursive query for aggregate views can be slow #3849

Closed
imsdu opened this issue Apr 27, 2023 · 0 comments · Fixed by #3879
Closed

The recursive query for aggregate views can be slow #3849

imsdu opened this issue Apr 27, 2023 · 0 comments · Fixed by #3879
Assignees

Comments

@imsdu
Copy link
Contributor

imsdu commented Apr 27, 2023

Describe the bug
The query related to aggregate views tends to be slow in production

2023-04-27 07:13:01 WARN  k.i.j.JdbcInstrumentation$LoggingProcessors$WarnOnSlowStatement - Query execution exceeded the [2000000000 nanoseconds] threshold and lasted [2050037418 nanoseconds]. The query was: [
 
 WITH RECURSIVE recursive_dependencies(org, project, id) AS (
 SELECT target_org, target_project, target_id
 FROM entity_dependencies
 WHERE org = ? and project = ? and id = ?
 UNION
 SELECT e.target_org, e.target_project, e.target_id
 FROM entity_dependencies e, recursive_dependencies r
 WHERE e.org = r.org
 AND e.project = r.project
 AND e.id = r.id
 ) CYCLE id SET is_cycle USING path 
 SELECT s.value
 FROM recursive_dependencies d, scoped_states s
 WHERE s.org = d.org
 AND s.project = d.project
 AND s.id = d.id
       ]

Expected behavior
The query should be reworked to be faster

@imsdu imsdu changed the title The recursive query for aggregate views is slow The recursive query for aggregate views can be slow Apr 27, 2023
@imsdu imsdu self-assigned this May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant