Re: efficiency of wildcards at both ends

From: Lonni J Friedman <netllama(at)gmail(dot)com>
To: Sam Z J <sammyjiang721(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: efficiency of wildcards at both ends
Date: 2012-06-20 17:20:58
Message-ID: CAP=oouGs2wCLYxNT_hhG44u-2e40k6_iCmRtTn-x8sSXqvSxBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 20, 2012 at 10:10 AM, Sam Z J <sammyjiang721(at)gmail(dot)com> wrote:
> Hi all
>
> 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?
>
> if the answers are too long, please point me to the relavant text =D

My limited understanding is that any time you need to resort to using
wildcards, indices are never used, and you're falling back to using
the inefficient table scan.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2012-06-20 17:22:41 Re: efficiency of wildcards at both ends
Previous Message utsav 2012-06-20 17:15:15 Re: RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION