"Erik Rijkers" <er(at)xs4all(dot)nl> writes:
> In a 112 MB test table (containing random generated text) with a trgm index (gin_trgm_ops), I consistently get these timings:
> select txt from azjunk6 where txt ~ '^abcd';
> 130 ms
> select txt from azjunk6
> where txt ~ 'abcd' and substr(txt,1,4) = 'abcd';
> 3 ms
Hm, could you provide a self-contained test case?
regards, tom lane