Dmitry Karasik <dk(at)catpipe(dot)net> writes:
> When database is initdb'ed with LC_CTYPE=C, the query uses index
> scan; when LC_CTYPE=en_US.UTF-8 it is the sequential scan.
This is in the FAQ:
When using wild-card operators such as LIKE or ~, indexes can only be
used in certain circumstances:
...
* The default C locale must be used during initdb because it is not
possible to know the next-greatest character in a non-C locale.
You can create a special text_pattern_ops index for such cases
that work only for LIKE indexing.
regards, tom lane