Skip to content

perf(checkpoint-sqlite): fix N+1 query in list() and alist()#7204

Open
Giorgi Duchidze (gduchidze) wants to merge 8 commits intolangchain-ai:mainfrom
gduchidze:gduchidze/fix-sqlite-n-plus-1-query
Open

perf(checkpoint-sqlite): fix N+1 query in list() and alist()#7204
Giorgi Duchidze (gduchidze) wants to merge 8 commits intolangchain-ai:mainfrom
gduchidze:gduchidze/fix-sqlite-n-plus-1-query

Conversation

@gduchidze
Copy link
Copy Markdown

@gduchidze Giorgi Duchidze (gduchidze) commented Mar 17, 2026

Resolves #7263

Replace per-checkpoint writes queries with a single batched query. For N checkpoints, this reduces database queries from N+1 to 2.

Thank you for contributing to LangGraph! Follow these steps to mark your pull request as ready for review. If any of these steps are not completed, your PR will not be considered for review.

  • PR title: Follows the format: {TYPE}({SCOPE}): {DESCRIPTION}

    • Examples:
      • feat(core): add multi-tenant support
      • fix(cli): resolve flag parsing error
      • docs(openai): update API usage examples
    • Allowed {TYPE} values:
      • feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release
    • Allowed {SCOPE} values (optional):
      • langgraph, docs, cli, checkpoint, checkpoint-postgres, checkpoint-sqlite, prebuilt, scheduler-kafka, sdk-py
    • Once you've written the title, please delete this checklist item; do not include it in the PR.
  • PR message: Delete this entire checklist and replace with

    • Description: a description of the change. Include a closing keyword if applicable.
    • Issue: the issue # it fixes, if applicable
    • Dependencies: any dependencies required for this change
    • Twitter handle: if your PR gets announced, and you'd like a mention, we'll gladly shout you out!
  • Add tests and docs: If you're adding a new integration, you must include:

    1. A test for the integration, preferably unit tests that do not rely on network access,
    2. An example notebook showing its use. It lives in docs/docs/integrations directory.
  • Lint and test: Run make format, make lint and make test from the root of the package(s) you've modified. We will not consider a PR unless these three are passing in CI. See contribution guidelines for more.

Additional guidelines:

  • Make sure optional dependencies are imported within a function.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Most PRs should not touch more than one package.
  • Changes should be backwards compatible.

@github-actions
Copy link
Copy Markdown
Contributor

This PR has been automatically closed because it does not link to an approved issue.

All external contributions must reference an approved issue or discussion. Please:

  1. Find or open an issue describing the change
  2. Wait for a maintainer to approve and assign you
  3. Add Fixes #<issue_number>, Closes #<issue_number>, or Resolves #<issue_number> to your PR description and the PR will be reopened automatically

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

@github-actions github-actions bot closed this Mar 24, 2026
@mdrxy Mason Daugherty (mdrxy) added bypass-issue-check Maintainer override: skip issue-link enforcement and removed missing-issue-link labels Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-issue-check Maintainer override: skip issue-link enforcement external

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(checkpoint-sqlite): N+1 query pattern in SqliteSaver.list() and AsyncSqliteSaver.alist()

2 participants