expression index not used within function

From: LPlateAndy <andy(at)centremaps(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: expression index not used within function
Date: 2013-11-13 22:45:31
Message-ID: 1384382731719-5778236.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have created an index as follows:

(replace(lower(my_column), ' '::text, ''::text)

which i use in a WHERE clause against LIKE 'string%'

By using text_pattern_ops i get the index used provided i more than one
character is used in the string.

However, with the same SELECT query running within a function (using RETURNS
TABLE) the query takes significantly longer - as though the index is
ignored. e.g. 2500ms instead of 12ms

Is there something fundamental i'm missing about the use of the indexed
expression?

Thanks!

Andy

--
View this message in context: http://postgresql.1045698.n5.nabble.com/expression-index-not-used-within-function-tp5778236.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message LPlateAndy 2013-11-13 23:22:06 Re: expression index not used within function
Previous Message Jeff Janes 2013-11-13 20:37:01 Re: freeze cannot be finished