charkost / prosopite

:mag: Rails N+1 queries auto-detection with zero false positives / false negatives
Apache License 2.0
1.48k stars 45 forks source link

False(?) positive with uniqueness validation #1

Closed bagedevimo closed 3 years ago

bagedevimo commented 3 years ago

We have a model with a series of unique: true validations. Prosopite is detecting the uniqueness checks as N+1s, because they are executed one after another as SELECT 1 as one FROM "table" WHERE "column"= $1 AND id != $2 LIMIT $3

charkost commented 3 years ago

Thanks for reporting! i will probably add an exception for uniqueness validations. It seems that there is no way for preventing the multiple queries there other than DB constraints.