Re: query very slow when enable_seqscan=on

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomasz Ostrowski <tometzky(at)batory(dot)org(dot)pl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: query very slow when enable_seqscan=on
Date: 2006-07-04 13:56:29
Message-ID: 13853.1152021389@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-performance

Tomasz Ostrowski <tometzky(at)batory(dot)org(dot)pl> writes:
> I think because there is no good solution to this - no statistical
> information is going to predict how much data will match a regular
> expression.

Well, it's certainly hard to imagine simple stats that would let the
code guess that, say, "warsa" and "warsaw" match nearly the same
(large) number of rows while "warsawq" matches nothing.

I think the real problem here is that regex matching is the wrong tool
for the job. Have you looked into a full-text index (tsearch2)?
With something like that, the index operator has at least got the
correct conceptual model, ie, looking for indexed words. I'm not sure
if they have any decent statistical support for it :-( but in theory
that seems doable, whereas regex estimation will always be a crapshoot.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-07-04 14:05:26 Re: ALTER TYPE ... USING(NULL) / NOT NULL violation
Previous Message Alexander M. Pravking 2006-07-04 11:03:02 ALTER TYPE ... USING(NULL) / NOT NULL violation

Browse pgsql-performance by date

  From Date Subject
Next Message Tomasz Ostrowski 2006-07-04 14:44:08 Re: query very slow when enable_seqscan=on
Previous Message David Gagnon 2006-07-04 13:33:20 Re: Is postgresql ca do the job for software deployed in ASP