Re: Worthwhile optimisation of position()?

From: Thomas Hallgren <thomas(at)tada(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tim Allen <tim(at)proximity(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Worthwhile optimisation of position()?
Date: 2006-03-24 06:51:57
Message-ID: 4423970D.9040608@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Tim Allen <tim(at)proximity(dot)com(dot)au> writes:
>
>> Thomas Hallgren wrote:
>>
>>> The position function must look for 'ch' everywhere in the string so
>>> there's no way it can use an index.
>>>
>
>
>> I think the '= 0' bit is what Chris was suggesting could be the basis
>> for an optimisation.
>>
>
> Yeah. AFAICS the transformation Chris suggested is valid. I'm really
> dubious that it's worth expending planner cycles to look for it though.
> LIKE is something that everybody and his brother uses, but who uses this
> position()=0 locution?
>
> regards, tom lane
>
The documentation says: position('om' in 'Thomas') == 3 so i assumed
that the returned index was 1-based and that a zero meant 'not found'.
If I'm wrong ,perhaps the docs need to be updated?

Regards,
Thomas Hallgren

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2006-03-24 06:58:54 Re: Worthwhile optimisation of position()?
Previous Message Tom Lane 2006-03-24 06:48:18 Re: Worthwhile optimisation of position()?