Re: [GENERAL] Relative performance of prefix and suffix string matching

2011-09-23 Thread Stéphane A. Schildknecht
Le 23/09/2011 12:30, Alban Hertroys a écrit : > On 23 September 2011 11:47, Andrew Rose > wrote: > > Basic Question: In text fields, is prefix matching significantly faster > than suffix matching? > > > It does depend on what type of index you use. BTr

Re: [GENERAL] Relative performance of prefix and suffix string matching

2011-09-23 Thread Alban Hertroys
On 23 September 2011 11:47, Andrew Rose wrote: > Basic Question: In text fields, is prefix matching significantly faster > than suffix matching? > It does depend on what type of index you use. BTrees split off text strings, from left to right, halving the number of records you need to scan at ev

Re: [GENERAL] Relative performance of prefix and suffix string matching

2011-09-23 Thread Tore Halvorsen
On Fri, Sep 23, 2011 at 11:47 AM, Andrew Rose wrote: > Basic Question: In text fields, is prefix matching significantly faster > than suffix matching? > If you are using text_pattern_ops, then yes. > 2. Alternatively, I could store column 'rev_str' as a reversed version of > column 'str' and h

[GENERAL] Relative performance of prefix and suffix string matching

2011-09-23 Thread Andrew Rose
Basic Question: In text fields, is prefix matching significantly faster than suffix matching? Background: I'm designing a database schema where a common operation will be "search for substring x either at the beginning or end of column 'str'". 1. I could have the client issue... SELECT * FROM