[GENERAL] Different query plan used for the same query depending on how parameters are passed

2017-05-16 Thread David Chapman
I have a table that includes two text columns t1 and t2, and a composite index on these columns. When issuing a query of the following form: SELECT * FROM test WHERE t1 = 'X' and t2 = ANY(ARRAY['Y1', 'Y2', ..]) I have observed that it will use the index and have reasonable performance if the whol

Re: [GENERAL] Different query plan used for the same query depending on how parameters are passed

2017-05-16 Thread David Chapman
efined as character(1) rather than text. I can see Postgres has cast the first parameter to bpchar in the first case but I guess Npgsql is explicitly sending it as type text, which bypasses the index. On 16 May 2017 at 15:17, Adrian Klaver wrote: > On 05/16/2017 06:01 AM, David Chapman wrote: >