It seems that with prepared statements (possibly n...
# spicedb
It seems that with prepared statements (possibly not only prepared statements), "PostgreSQL has a built-in heuristics form statements whose plans can be cached: it plans them with the actual parameter values for the first 5 times, and then it switches to a generic plan if that plan promises not to perform worse. Unfortunately the generic plan doesn't keep the promise in this case." (source here: So, in my case it's possible that PG takes into account the actual value of the
parameter for the first 5 execution: that'll be fast. From the 6th execution onwards, it doesn't consider what value
actually has and always applies a generic query plan: this generic query plan is much much slower for the values of
we actually use