From: Guillaume Lelarge <guillaume@lelarge.info>
To: AI Rumman <rummandba@gmail.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: Re: index is not using
Date: Tue, 09 Feb 2010 10:34:04 +0100
Message-ID: <4B712C0C.6040906@lelarge.info> (raw)
In-Reply-To: <2a7905441002082343g1dd0c8ebg5a27f7d44ec9fdb1@mail.gmail.com>
References: <2a7905441002082343g1dd0c8ebg5a27f7d44ec9fdb1@mail.gmail.com>
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
> PLAN
> --------------------------------------------------------------------------------------------------------
> 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%'.
--
Guillaume.
http://www.postgresqlfr.orghttp://dalibo.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: guillaume@lelarge.info, rummandba@gmail.com, pgsql-general@postgresql.org
Subject: Re: index is not using
In-Reply-To: <4B712C0C.6040906@lelarge.info>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox