Search Postgresql Archives

Re: Partial index with regexp not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Richard Huxton <dev@xxxxxxxxxxxx> 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.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux