Skip to content

Warn on performance issues: non-normalized result set#1271

Merged
lgebhardt merged 1 commit intomasterfrom
warn_on_performance_issues
Jul 19, 2019
Merged

Warn on performance issues: non-normalized result set#1271
lgebhardt merged 1 commit intomasterfrom
warn_on_performance_issues

Conversation

@lgebhardt
Copy link
Copy Markdown
Contributor

@lgebhardt lgebhardt commented Jul 19, 2019

With the removal of the distinct call in #1225 it's now possible for a user who overrides records and joins in a has_many relationship to experience extremely slow responses due to non-normalized data. Using distinct was hiding this database access faux pas.

This PR adds detection based on the assumption that every row in the result set should translate into a unique resource fragment. If the counts do not match a warning is given in the logs. This warning can be controlled with a new configuration option, warn_on_performance_issues.

It's planned that future performance issue checks will be controlled with the same configuration setting.

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

@lgebhardt lgebhardt force-pushed the warn_on_performance_issues branch from d42bc6f to 8424271 Compare July 19, 2019 14:54
@lgebhardt lgebhardt merged commit bc783b5 into master Jul 19, 2019
@lgebhardt lgebhardt deleted the warn_on_performance_issues branch July 19, 2019 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants