Re: Prepare Statement VS Literal Values

2021-04-12 Thread Virendra Kumar
Thank you for the pointer, here is plan now, it is much better: testdb=# prepare fooplan(character varying,character varying ,bigint,character varying) AS select testdb-# this_.warehouse_cost_id , this_.asin , this_.base_currency_code, testdb-# this_.cost , this_.cost_acquisition_date , this_.cos

Re: Prepare Statement VS Literal Values

2021-04-11 Thread Ravi Krishna
This looks like early vs late binding problem, also seen in  other products.  When you prepare the sql, the optimizer has no way of knowing the values which is going to be supplied in future.  So it is possible that at the time of preparing PG settles on a plan and uses it for all values, regardles