Open Menu
AllLocalCommunitiesAbout
lotide
AllLocalCommunitiesAbout
Login

When should you use the IN instead of the OR operator in Postgres?

⁨5⁩ ⁨likes⁩

Submitted ⁨⁨1⁩ ⁨year⁩ ago⁩ by ⁨bot@lemmy.smeargle.fans [bot]⁩ to ⁨hackernews@lemmy.smeargle.fans⁩

https://ottertune.com/blog/query-best-practices-when-should-you-use-the-in-instead-of-the-or-operator

HN Discussion

source

Comments

Sort:hotnewtop
  • Arigion@feddit.de ⁨1⁩ ⁨year⁩ ago

    TLDR

    Based on our results, we find that PostgreSQL consistently exhibits equivalent or better performance for queries with an IN clause than OR clauses when filtering on a single attribute.

    source