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

Add duplicate SQL query detector (OSOE-353) #93

Open
Piedone opened this issue Sep 5, 2021 · 0 comments · May be fixed by #216
Open

Add duplicate SQL query detector (OSOE-353) #93

Piedone opened this issue Sep 5, 2021 · 0 comments · May be fixed by #216
Assignees
Labels
enhancement New feature or request

Comments

@Piedone
Copy link
Member

Piedone commented Sep 5, 2021

When one implements a SELECT N+1 query how it manifests is that the same query (apart from the parameters) will be executed multiple times during page load. While not every duplicated query is a problem, we could add a feature to detect such queries and fail the given test. A per-test configurable threshold would be a good start (e.g. "fail if any query is executed >3 times").

An approach would be to use the Orchard Core Mini Profiler feature for this. A better one would be to implement our similar profiling logic to tap into the OC app since that wouldn't potentially break the UI (as the Mini Profile toolbar can). Perhaps it's possible to get the info out of Mini Profiler without showing the UI.

Similarly, we could have a mechanism to detect queries that fetch too many rows but probably there are no such simple heuristics for that (otherwise, we could do the same approach and have a configurable threshold).

Common APIs for OrchardCMS/OrchardCore#12251 can help here too.

Jira issue

@Piedone Piedone added the enhancement New feature or request label Sep 5, 2021
@github-actions github-actions bot changed the title Add duplicate SQL query detector Add duplicate SQL query detector (OSOE-353) Sep 18, 2022
@dministro dministro self-assigned this Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants