Re: efficiency of wildcards at both ends

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: efficiency of wildcards at both ends
Date: 2012-06-20 19:29:28
Message-ID: jrt899$g5j$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alan Hodgson wrote on 20.06.2012 19:39:
>> I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%'
>> How efficient is it if that's the only search criteria against a large
>> table? how much does indexing the column help and roughly how much more
>> space is needed for the index?
>>
>
> Indexing helps not at all. If the search string starts with a wildcard you
> will always get a sequential scan of the whole table.

Not necessarily: http://www.depesz.com/2011/02/19/waiting-for-9-1-faster-likeilike/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2012-06-20 19:59:49 Re: RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION
Previous Message Bosco Rama 2012-06-20 19:13:21 Re: Simple method to format a string?