Re: [GENERAL] Query in function not using index...

2007-04-28 Thread Tom Lane
Listmail <[EMAIL PROTECTED]> writes: >> We were looking at the explain results and noticed that it was >> converting >> the 'wynn%' into fname >= 'wynn' and fname < 'wyno' > Does this also work if the last character is a unicode character ? In C locale it does, though you have to be caref

Re: [GENERAL] Query in function not using index...

2007-04-28 Thread Listmail
Tom, We were looking at the explain results and noticed that it was converting the 'wynn%' into fname >= 'wynn' and fname < 'wyno' Does this also work if the last character is a unicode character ? ---(end of broadcast)--- TIP 1: if

Re: [GENERAL] Query in function not using index...

2007-04-27 Thread John Cole
PROTECTED] Sent: Friday, April 27, 2007 5:57 PM To: Listmail Cc: John Cole; 'pgsql-general@postgresql.org' Subject: Re: [GENERAL] Query in function not using index... Listmail <[EMAIL PROTECTED]> writes: >> Any idea why using a variable v_streetName instead of a string &#

Re: [GENERAL] Query in function not using index...

2007-04-27 Thread Tom Lane
Listmail <[EMAIL PROTECTED]> writes: >> Any idea why using a variable v_streetName instead of a string 'wynn%' >> behaves differently? > Yeah. > 'wynn%' doesn't start with % so LIKE uses index. > But Postgres doesn't know that you know that the contents of this > variable never

Re: [GENERAL] Query in function not using index...

2007-04-27 Thread Listmail
Any idea why using a variable v_streetName instead of a string 'wynn%' behaves differently? Yeah. 'wynn%' doesn't start with % so LIKE uses index. But Postgres doesn't know that you know that the contents of this variable never starts with '%'... Thanks, John ---

[GENERAL] Query in function not using index...

2007-04-27 Thread John Cole
Hello, I need some help with a query inside a function. The table has 31M rows in it (us streets), and a select statement takes 10ms when using an index built for the query... But, when the same query is in a function and uses a variable the index isn't used and the query takes a few minutes.