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

feat: prefer ANY over IN for postgres #60

Merged
merged 5 commits into from
Oct 18, 2023
Merged

feat: prefer ANY over IN for postgres #60

merged 5 commits into from
Oct 18, 2023

Conversation

cofin
Copy link
Member

@cofin cofin commented Oct 18, 2023

Pull Request Checklist

  • New code has 100% test coverage
  • (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
  • (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR
  • Pre-Commit Checks were ran and passed
  • Tests were ran and passed

Description

This PR set the Postgres dialects to prefer to use an ANY instead of an IN for filtering a collection fo results.

select id
from my_table
where id = ANY(:1)

instead of

select id
from my_table
where id in (:1, :2, :3, ...)

This has the additional benefit of allowing us to avoid hitting the max bind parameters values of the engine.

Close Issue(s)

@cofin cofin requested review from a team as code owners October 18, 2023 00:54
@sonarcloud
Copy link

sonarcloud bot commented Oct 18, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@github-actions
Copy link

Documentation preview will be available shortly at https://jolt-org.github.io/advanced-alchemy-docs-preview/60

@cofin cofin merged commit 9d8cf62 into main Oct 18, 2023
9 of 10 checks passed
@cofin cofin deleted the postgres-in-to-any branch October 18, 2023 14:07
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