Uh oh!
There was an error while loading. Please reload this page.
Document N+1 query detection in integration tests - #568
Merged
Conversation
Companion to flarum/framework#4871, which fails integration tests whose requests run N+1 queries. Explains how to read a failure, what the binding count means, and how to exempt a legitimately repeated query shape.
1 task
Follows the two-tier behaviour in flarum/framework#4871: one query per record fails the test, while a query repeated for the same few values raises a warning instead.
Follows flarum/framework#4871: the example phpunit config now displays warning details, and findings appear as pull request annotations and a run summary in CI via FLARUM_REPEATED_QUERY_LOG.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents the N+1 detection added in flarum/framework#4871: requests sent through the integration
TestCaseare checked for N+1 query patterns and the test fails when one is found.Covers how to read a failure (including what the distinct-bindings count tells you — one query per record is an N+1, many repeats of one binding is a missed memoisation), and the escape hatches in preference order:
allowedRepeatedQueries()for a single shape,detectsRepeatedQueries()for a test case,FLARUM_DETECT_REPEATED_QUERIES=0for a whole run.Should merge alongside or after flarum/framework#4871.