Re: [PERFORM] Index on VARCHAR with text_pattern_ops inside PL/PGSQL procedure.

2007-12-13 Thread Piotr Gasidło
2007/12/10, Piotr Gasidło <[EMAIL PROTECTED]>: > Why PL/PGSQL is unable to proper utilize > users_user_name_unique_text_pattern_ops? I found solution, that satisfies me (EXECUTE is a bit ugly for me). I've replaced LIKE operator with ~=~ operator. Now PL/PGSQL function properly uses index on SELE

Re: [PERFORM] Index on VARCHAR with text_pattern_ops inside PL/PGSQL procedure.

2007-12-10 Thread Pavel Stehule
Hello this is known problem of prepared statements. Prepared statement has plan built without knowledge any values and should not be optimal. try use dynamic query and statement EXECUTE INTO Regards Pavel Stehule On 10/12/2007, Piotr Gasidło <[EMAIL PROTECTED]> wrote: > Hello, > > I've create

Re: [PERFORM] Index on VARCHAR with text_pattern_ops inside PL/PGSQL procedure.

2007-12-10 Thread Richard Huxton
Piotr Gasidło wrote: Some performance loss, but OK. Now I've changed "=" into "LIKE" to use users_user_name_unique_text_pattern_ops index and rerun query: explain analyze select user_login('quaker'); QUERY PLAN -

[PERFORM] Index on VARCHAR with text_pattern_ops inside PL/PGSQL procedure.

2007-12-10 Thread Piotr Gasidło
Hello, I've created table: quaker=> \d users Table "public.users" Column | Type| Modifiers ---+---+ id| integer | not null defau