Re: LIKE and regex

From: "Mitch Vincent" <mitch(at)venux(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: LIKE and regex
Date: 2000-05-18 17:25:28
Message-ID: 01c101bfc0ee$0fe3ccc0$4100000a@venux.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> No, it's just a pretty brain-dead scanner. You can find the code in
> backend/utils/adt/like.c if you care.

I shall take a look, thanks!

> Perhaps it'd make sense to translate the LIKE pattern into an equivalent
> regex and then use the regex code, but no one's done it.
>
> > I'm trying to find the
> > quickest / fastest way to search for any occurance of a given string in
a
> > stored field.
> > query: select * from applicants where firstname LIKE '%mitch%';
> > query: select * from applicants where firstname ~ lower('mitch');
>
> I think the actual operator processing is going to be swamped by
> tuple-fetching overhead, so there's not going to be much difference.
> What you ought to be thinking about is how you could replace the
> brute-force scan with an index lookup. Possibly you could adapt the
> ideas in contrib/fulltextindex.

That's exactly what I'm doing (using ideas in contrib/fulltextindex) -- The
database is huge! (33 million rows right now) so it's taking quite some time
to do any operations on the database right now.. This is certainly to be
expected with as much data as there is stored in there.

It seems both LIKE and ~ uses the index I created, so that's all good...

I'm going to stick with the regex search I think, a co-worker was asking
about the LIKE operator, so I thought I would ask the guys that truely have
a clue!

Thanks again..

-Mitch

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Brian C. Doyle 2000-05-18 18:01:37 Novice Help Needed
Previous Message Kyle Bateman 2000-05-18 16:53:51 Pre-toast toast to toast