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

Repeating queries when constance is installed #504

Closed
ericswpark opened this issue Nov 23, 2022 · 2 comments
Closed

Repeating queries when constance is installed #504

ericswpark opened this issue Nov 23, 2022 · 2 comments

Comments

@ericswpark
Copy link

Describe the problem

Sentry is reporting that constance is performing a n + 1 query whenever the main page of my website loads. Strangely the main page does not use any configuration values from constance (as far as I can tell).

Repeating query

SELECT "constance_config"."id", "constance_config"."key", "constance_config"."value" FROM "constance_config" WHERE "constance_config"."key" = %s LIMIT 21

N+1 Query SELECT constance_config id, constance_config key, constance_config value FROM constance_config WHERE c

System configuration

  • Django version: 4.1.3
  • Python version: CPython 3.10.6
  • Django-Constance version: [database] 2.9.1
@sergei-iurchenko
Copy link
Contributor

Use can use django-debug-toolbar to find the source of the query

@ericswpark
Copy link
Author

Apparently the main page uses some configuration values which I forgot about, which was revealed with django-debug-toolbar (thanks @sergei-iurchenko !) I've decided to leave them as the page is cached so it's not such a performance concern.

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

No branches or pull requests

2 participants