HNHacker News
TopNewBestAskShowJobs

angry__panda

77 karma · joined April 26, 2023

submissionscomments
angry__panda··on When should you use the IN instead of the OR operator in Postgres?
Based on my experiments, Postgres switches from scanning the list to a hash when the array size > 8.
angry__panda··on When should you use the IN instead of the OR operator in Postgres?
This is true for Postgres. But might not be true for other databases. For example, for MySQL, in some cases OR is faster than IN operator based on our experiments.
angry__panda··on When should you use the IN instead of the OR operator in Postgres?
The article mentioned that it's tested on Postgres 14:

"We used a PostgreSQL v14 database on a db.t3.medium Amazon RDS instance equipped with 2 CPUs and 4GB RAM. The storage capacity is 200GB (gp2 storage)."