Re: [GENERAL] index is not using

From: Guillaume Lelarge
Subject: Re: [GENERAL] index is not using
Date: ,
(view: Whole thread, Raw)
List: pgsql-performance

Le 09/02/2010 08:43, AI Rumman a écrit :
> I have created a index
> create index leadaddress_phone_idx on
> leadaddress(regexp_replace((phone)::text, '[^0-9]*'::text, ''::text,
> 'g'::text));
> But the index is not using.
> explain select * from leadaddress where
> regexp_replace(phone,'[^0-9]*','','g') like '%2159438606';
>                                                QUERY
> --------------------------------------------------------------------------------------------------------
>  Seq Scan on leadaddress  (cost=100000000.00..100009699.81 rows=1 width=97)
>    Filter: (regexp_replace((phone)::text, '[^0-9]*'::text, ''::text,
> 'g'::text) ~~ '%2159438606'::text)
> Could anyone please tell me why? I analyzed the table after index creation.

The index cannot be used if the filter is '%something' or
'%somethingelse%'. I can only be used for 'this%'.


pgsql-performance by date:

From: "Albe Laurenz"
Subject: Re: foreign key constraint lock behavour in postgresql
From: "Kevin Grittner"
Subject: moving pg_xlog -- yeah, it's worth it!