Re: [GENERAL] indexed regex select optimisation missing?

From: "Gene Selkov, Jr(dot)" <selkovjr(at)mcs(dot)anl(dot)gov>
To: Stuart Woolford <stuartw(at)newmail(dot)net>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] indexed regex select optimisation missing?
Date: 1999-11-04 05:23:12
Message-ID: 199911040622.AAA23488@antares
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roomi 1999-11-04 06:41:53 !!! Urgent: btree: lost page
Previous Message Yury Don 1999-11-04 04:39:21 Plpgsql qestion