Yup I’ve had to debug an issue exactly like this. An IN statement that when populated with <7 parameters would happily use an index but when populated with >=7 parameters would decide to do a full table scan. I was quite dismayed to discover Postgres doesn’t support index hints like MySQL does when I came to fix it.