From: | Richard Broersma Jr <rabroersma(at)yahoo(dot)com> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com>, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Partial index with regexp not working |
Date: | 2007-09-11 11:42:43 |
Message-ID: | 763667.26221.qm@web31806.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
--- Richard Huxton <dev(at)archonet(dot)com> wrote:
> Phoenix Kiula wrote:
> > CREATE INDEX idx_trades_tid_partial ON trades (trader_id)
> > WHERE trader_id ~ '[a-z]' ;
>
> > WHERE trader_id = 'johndoe'
> >
> > It is not using this index at all! It is using no index in fact, it's
> > trying to do a sequential scan. Any ideas why this partial index is
> > not working??
> A partial index will only be considered if you test for its condition:
>
> SELECT ... WHERE trader_id = 'johndoe' AND trader_id ~ '[a-z]'
IIRC, for any index like this to work, doesn't the REGEXP need to be anchored to either the start
or end of the string?
Regards,
Richard Broersma Jr.
From | Date | Subject | |
---|---|---|---|
Next Message | Phoenix Kiula | 2007-09-11 11:48:47 | Hardware recommendation: which is best |
Previous Message | Richard Huxton | 2007-09-11 10:12:32 | Re: Partial index with regexp not working |