## GPT (gptmailinglists@xxxxxxxxx): > Why this incident has been observed when the statement is only within > a function with variable as input parameter and not when they run > directly with explicitly defined parameter/ In the first case, plan > remains stable and does not change; but in the second case plan > changes. There you have it: that's exactly the plan caching behaviour described in the link I posted upthread. PL/pgSQL created a prepared statement on the first execution of a statement/expression inside a function, and, to quote that documentation: If the statement has no parameters, or is executed many times, the SPI manager will consider creating a generic plan that is not dependent on specific parameter values[...] > Anyway, this is too technical for me and even if you respond most > probably I am not gonna get it. But perhaps the next person researching similar question will profit from the mailing list archives. Regards, Christoph -- Spare Space.