William Temperley wrote:
> My problem is I have several text fields in the address data, for which
> postgres ignores the indexes (btree).
> "Index Scan using ap_idx_pc on ap (cost= 0.00..15.30 rows=1 width=188)"
> " Index Cond: (((pc_)::text >= 'OX2 0'::character varying) AND ((pc_)::text
> < 'OX2 1'::character varying))"
> " Filter: ((pc_)::text ~~ 'OX2 0%'::text)"
>
> And the NEW:-
> "Seq Scan on ap (cost=0.00..4652339.33 rows=1 width=189)"
> " Filter: ((pc_)::text ~~ 'OX2 0%'::text)"
It's almost certainly a locale thing. Your old locale was "C" and the
new one is "en_GB.UTF-8" or similar. This means that simple sorting has
been replaced by something more library-like.
You can either dump the database, re-run initdb with the "C" locale and
restore, or read up on text_pattern_ops/varchar_pattern_ops in the
manual (11.8. Operator Classes). Basically it tags an index as working
with pattern-matching in the current locale.
> the strange thing is my btree indexes on the uk roads data work fine.
Do they use like, or explicit range-checks?
--
Richard Huxton
Archonet Ltd