René's URL Explorer Experiment


Title: add db cleanup for PyPy by mattip · Pull Request #472 · python/pyperformance · GitHub

Open Graph Title: add db cleanup for PyPy by mattip · Pull Request #472 · python/pyperformance

X Title: add db cleanup for PyPy by mattip · Pull Request #472 · python/pyperformance

Description: Claude helped me come up with this fix for hundreds of emitted warnings, with the justification: SQLite reuses primary key IDs after a full table DELETE (it has no AUTOINCREMENT sequence to preserve), the next loop iteration inserts new Person and Address objects with the same IDs (1..N) as the previous run. On CPython this is harmless: refcounting immediately collects the old objects when new_person is reassigned each iteration, clearing the identity map's weakrefs before the next loop. On PyPy, GC is deferred - the old objects remain alive, so the identity map still holds live entries for IDs 1..N. When the new objects are committed with the same keys, SQLAlchemy's _register_persistent detects the collision and emits: SAWarning: Identity map already had an identity for (Person, (1,), None), replacing it with newly flushed object. Are there load operations occurring inside of an event handler within the flush? This warning fires for every inserted row on every benchmark loop, flooding stderr and causing the benchmark to fail on PyPy. Fix: call session.expunge_all() immediately after the bulk deletes to explicitly clear the stale session state before timing begins. It would be nice to have someone who understands more about sqlalchemy than me review this for correctness, I am not sure this is the right place for a fix.

Open Graph Description: Claude helped me come up with this fix for hundreds of emitted warnings, with the justification: SQLite reuses primary key IDs after a full table DELETE (it has no AUTOINCREMENT sequence to preserv...

X Description: Claude helped me come up with this fix for hundreds of emitted warnings, with the justification: SQLite reuses primary key IDs after a full table DELETE (it has no AUTOINCREMENT sequence to preserv...

Opengraph URL: https://github.com/python/pyperformance/pull/472

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e945bba3-34d9-7086-bff8-861278df4200
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8386:38E318:2D3D0A3:394E744:6B01EC57
html-safe-nonce2289d0b4c702c39e7c1233fff99a445a605b61779702caff37215ac9bbf60d4c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Mzg2OjM4RTMxODoyRDNEMEEzOjM5NEU3NDQ6NkIwMUVDNTciLCJ2aXNpdG9yX2lkIjoiODUzOTU5ODcxOTU0NzQ2ODg4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1b56c75847c5b143821ea5a6adde7eaaeb164fbce11dffe7ce940334bd75f015
hovercard-subject-tagpull_request:3656506361
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/pyperformance/pull/472/files
twitter:imagehttps://avatars.githubusercontent.com/u/823911?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/823911?s=400&v=4
og:image:altClaude helped me come up with this fix for hundreds of emitted warnings, with the justification: SQLite reuses primary key IDs after a full table DELETE (it has no AUTOINCREMENT sequence to preserv...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/pyperformance git https://github.com/python/pyperformance.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id65949828
octolytics-dimension-repository_nwopython/pyperformance
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id65949828
octolytics-dimension-repository_network_root_nwopython/pyperformance
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/pyperformance/pull/472/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fpyperformance%2Fpull%2F472%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fpyperformance%2Fpull%2F472%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fpyperformance
Reloadhttps://github.com/python/pyperformance/pull/472/files
Reloadhttps://github.com/python/pyperformance/pull/472/files
Reloadhttps://github.com/python/pyperformance/pull/472/files
pythonhttps://github.com/python
pyperformancehttps://github.com/python/pyperformance
Codehttps://github.com/python/pyperformance
Issues53 (53)https://github.com/python/pyperformance/issues
Pull requests34 (34)https://github.com/python/pyperformance/pulls
Actionshttps://github.com/python/pyperformance/actions
Projectshttps://github.com/python/pyperformance/projects
Security and qualityhttps://github.com/python/pyperformance/security
Insightshttps://github.com/python/pyperformance/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fpyperformance%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fpyperformance%2Fissues%2Fnew%2Fchoose
mattiphttps://github.com/mattip
python:mainhttps://github.com/python/pyperformance/tree/main
mattip:sqlachemy-expunge_allhttps://github.com/mattip/pyperformance/tree/sqlachemy-expunge_all
Conversation 4 https://github.com/python/pyperformance/pull/472
Commits 2 https://github.com/python/pyperformance/pull/472/commits
Checks 19 https://github.com/python/pyperformance/pull/472/checks
Files changed https://github.com/python/pyperformance/pull/472/files
Please reload this pagehttps://github.com/python/pyperformance/pull/472/files
add db cleanup for PyPy https://github.com/python/pyperformance/pull/472/files#top
Show all changes 2 commits https://github.com/python/pyperformance/pull/472/files
8dc18f9 add db cleanup for PyPy mattip May 10, 2026 https://github.com/python/pyperformance/pull/472/commits/8dc18f91ea96e3493c6ad80e4aae3dd7beb61e15
dedaa04 do session resetting differently, from review mattip May 10, 2026 https://github.com/python/pyperformance/pull/472/commits/dedaa04ea365f7d3f4878091578e87ba5e3fdab4
Clear filters https://github.com/python/pyperformance/pull/472/files
Please reload this pagehttps://github.com/python/pyperformance/pull/472/files
Please reload this pagehttps://github.com/python/pyperformance/pull/472/files
pyperformance/data-files/benchmarks/bm_sqlalchemy_declarative/run_benchmark.pyhttps://github.com/python/pyperformance/pull/472/files#diff-28b0ded096e7cbeb3548b030bdb04b982dd3f16e6a0efb0a2cf033241154253c
View file https://github.com/python/pyperformance/blob/dedaa04ea365f7d3f4878091578e87ba5e3fdab4/pyperformance/data-files/benchmarks/bm_sqlalchemy_declarative/run_benchmark.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/pyperformance/pull/472/{{ revealButtonHref }}
https://github.com/python/pyperformance/pull/472/files#diff-28b0ded096e7cbeb3548b030bdb04b982dd3f16e6a0efb0a2cf033241154253c
https://github.com/python/pyperformance/pull/472/files#diff-28b0ded096e7cbeb3548b030bdb04b982dd3f16e6a0efb0a2cf033241154253c
zzzeekhttps://github.com/zzzeek
May 10, 2026https://github.com/python/pyperformance/pull/472/files#r3214995421
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/pyperformance/pull/472/files
mattiphttps://github.com/mattip
May 10, 2026https://github.com/python/pyperformance/pull/472/files#r3215155141
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/pyperformance/pull/472/files
https://github.com/python/pyperformance/pull/472/files#diff-28b0ded096e7cbeb3548b030bdb04b982dd3f16e6a0efb0a2cf033241154253c
Please reload this pagehttps://github.com/python/pyperformance/pull/472/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.