On January 13, 2016 3:02:27 PM GMT+01:00, Vladimir Sitnikov <sitnikov.vladi...@gmail.com> wrote: >> The custom plan is *more expensive*; > >You compare costs of custom vs generic plans. >I suggest: do not compare costs *at all*. > >>I don't know, it's your proposal :-) But it looks like I >misunderstood. > >It is not. > >My suggestion is: build a generic plan (that is the plan that will >return proper result for every possible bind value), yet refer to the >values of 6th binds when estimating cardinalitites. >Is it clear now?
That's not going to fly for two reasons: for one custom plans can be much better than the generic plan, independent of cardinalities. Consider e.g. a partitioned table, where the generic scan will scan all partitions. For another, just using the specific values for the generic plan will have horrible results if the distribution isn't entirely boring, consider e.g a table with one somewhat common and otherwise just unique values. --- Please excuse brevity and formatting - I am writing this on my mobile phone. -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers