Re: [GENERAL] indexed regex select optimisation missing?
selkovjr@mcs.anl.gov
From: "Gene Selkov, Jr." <selkovjr@mcs.anl.gov>
To: Stuart Woolford <stuartw@newmail.net>, pgsql-general@postgreSQL.org
Date: 1999-11-04T05:23:12Z
Lists: pgsql-general
> select key from inv_word_i where word='whatever' order by count desc ; > > and this is fast, however, if I use: > > select key from inv_word_i where word~'^whatever.*' order by count desc ; > > it is very slow. Did you try '^whatever' instead of '^whatever.*'? Based on common sense, the former should be much faster than the latter, which would match any cahracter any number of times, unless the regexp is optimized to avoid that. --Gene