Title: Sentry detects N+1 queries in server side cursor · Issue #6576 · getsentry/sentry-python · GitHub
Open Graph Title: Sentry detects N+1 queries in server side cursor · Issue #6576 · getsentry/sentry-python
X Title: Sentry detects N+1 queries in server side cursor · Issue #6576 · getsentry/sentry-python
Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.61.1 Steps to Reproduce We recently updated from sentry 2.57.0 to 2.61.1 and we started getting many reports of N+1 queries in the Sentry UI. This was tracked to PR #6252. In our p...
Open Graph Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.61.1 Steps to Reproduce We recently updated from sentry 2.57.0 to 2.61.1 and we started getting many reports of N+1 queries in the Sentry UI...
X Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.61.1 Steps to Reproduce We recently updated from sentry 2.57.0 to 2.61.1 and we started getting many reports of N+1 queries in the Sentry UI...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/6576
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry detects N+1 queries in server side cursor","articleBody":"### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Version\n\n2.61.1\n\n### Steps to Reproduce\n\nWe recently updated from sentry 2.57.0 to 2.61.1 and we started getting many reports of [N+1 queries](https://docs.sentry.io/product/issues/issue-details/performance-issues/n-one-queries/) in the Sentry UI. This was tracked to PR #6252.\n\nIn our particular case, we use sqlalchemy with asyncpg and the queries that are being flagged are all due to the use of server side cursors.\n\nOur code is as follows:\n\n```python\nawait conn.stream(query)\n```\n\nIs there any workaround? Should we just disable the AsyncPGIntegration if using sqlalchemy?\n\n### Expected Result\n\nNo N+1 queries should be detected when using `conn.stream`.\n\n### Actual Result\n\nLot of flagged N+1 queries in Sentry's UI","author":{"url":"https://github.com/sk-","@type":"Person","name":"sk-"},"datePublished":"2026-06-15T20:39:08Z","url":"https://github.com/getsentry/sentry-python/issues/6576"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:81e0e18b-6bd2-9eff-a95d-b6e20eb64822 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBD6:CC1A4:72C98:967B4:6B00C533 |
| html-safe-nonce | 2ab8c690829003899c44b769f53444cc3ca68877751b313778d23eb2aa6595fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkQ2OkNDMUE0OjcyQzk4Ojk2N0I0OjZCMDBDNTMzIiwidmlzaXRvcl9pZCI6IjE4MTU0NzMxNTE1NzY5NTAwNjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 08352860265e4629a72582c0b9f89fe2a973ff559a548593a996971a87eebb53 |
| hovercard-subject-tag | issue:4668732846 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/6576/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cceca28cc2a40bf4d79d5d684d8c55272f995d7ca9ba42ef2070c9369db50b6b/getsentry/sentry-python/issues/6576 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cceca28cc2a40bf4d79d5d684d8c55272f995d7ca9ba42ef2070c9369db50b6b/getsentry/sentry-python/issues/6576 |
| og:image:alt | How do you use Sentry? Sentry Saas (sentry.io) Version 2.61.1 Steps to Reproduce We recently updated from sentry 2.57.0 to 2.61.1 and we started getting many reports of N+1 queries in the Sentry UI... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sk- |
| hostname | github.com |
| expected-hostname | github.com |
| None | 93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1fee81a280ea86312b69448e261b418189bfd5b5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width