[GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Robert James
Hi. I'm confused about the behavior of LIKE under utf8 locale. Accoding to the docs ( http://www.postgresql.org/docs/8.2/interactive/locale.html - excerpted below), it seems that LIKE ignores locale and hence can't use indexes. Yet, EXPLAIN clearly shows it using indexes. The docs suggest a

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Greg Stark
On Wed, Jul 22, 2009 at 5:57 PM, Robert Jamessrobertja...@gmail.com wrote: Hi.  I'm confused about the behavior of LIKE under utf8 locale. Accoding to the docs ( http://www.postgresql.org/docs/8.2/interactive/locale.html - excerpted below), it seems that LIKE ignores locale and hence can't use

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Jeff Davis
On Wed, 2009-07-22 at 12:57 -0400, Robert James wrote: The docs suggest a workaround, to allow LIKE to use indexes - but I couldn't figure it out. Although I'm stuck with locale utf8, all my data is 7-bit ascii. I'm doing a tremendous amount of WHERE x LIKE 'abc%' - what's the best way to

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Tom Lane
Robert James srobertja...@gmail.com writes: Hi. I'm confused about the behavior of LIKE under utf8 locale. UTF8 is not a locale, it's an encoding. If you're using C locale then LIKE can use indexes, regardless of the encoding. If you're using some other locale then you need a pattern_ops

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Robert James
Thank you, Tom. I guess I'm a bit confused about things here. How can I find the locale of my database? (I wasn't able to find this in the docs). If I do have the locale set to 'C', do I loose anything by using utf8 for all text fields? On Wed, Jul 22, 2009 at 4:31 PM, Tom Lane

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Andreas Wenk
Robert James wrote: Thank you, Tom. I guess I'm a bit confused about things here. How can I find the locale of my database? (I wasn't able to find this in the docs). If I do have the locale set to 'C', do I loose anything by using utf8 for all text fields? use psql: postgres=# \l+

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Robert James
Thanks - I don't show any locale: rbt_development= \l List of databases Name | Owner | Encoding +-+-- rbt_development | rbt | UTF8 ... On Wed, Jul 22, 2009 at 6:45 PM, Andreas Wenk a.w...@netzmeister-st-pauli.de wrote: Robert James

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Andreas Wenk
Robert James wrote: Thanks - I don't show any locale: rbt_development= \l List of databases Name | Owner | Encoding +-+-- rbt_development | rbt | UTF8 ... ahm - you are running pg 8.2. There I think the + option is not available

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Andreas Wenk
Andreas Wenk wrote: Robert James wrote: Thanks - I don't show any locale: rbt_development= \l List of databases Name | Owner | Encoding +-+-- rbt_development | rbt | UTF8 ... ahm - you are running pg 8.2. There I think the + option

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Tom Lane
Andreas Wenk a.w...@netzmeister-st-pauli.de writes: Robert James wrote: Thanks - I don't show any locale: ahm - you are running pg 8.2. There I think the + option is not available (\l+). So if you use a debian based system and installed it via the package manager apt or aptitude you could