Christian Hammers <ch(at)lathspell(dot)de> writes:
> Just because I added a "LIMIT 1" to the following query, PostgreSQL decided to
> use a different index which gives a far worse performance :-(
The problem is the off-by-four-orders-of-magnitude rowcount estimate
(20949 rows estimated to match, only 2 actually do). You need to get
that to be closer to reality. I'm not sure if increasing the statistics
target would help --- it depends on whether the prefix extension has any
non-dummy selectivity estimation support. If not, you might want to
consider switching to a more-fully-supported data type.
regards, tom lane