pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomasz Ostrowski <tometzky@batory.org.pl>
Cc: pgsql-bugs@postgresql.org
Subject: Re: query very slow when enable_seqscan=on
Date: Tue, 04 Jul 2006 09:56:29 -0400
Message-ID: <13853.1152021389@sss.pgh.pa.us> (raw)
In-Reply-To: <20060704083733.GA20102@batory.org.pl>
References: <20060703203105.GA2801@batory.org.pl>
	<7353.1151967946@sss.pgh.pa.us>
	<20060704083733.GA20102@batory.org.pl>

Tomasz Ostrowski <tometzky@batory.org.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



view thread (9+ messages)  latest in thread

Message-ID: <13853.1152021389@sss.pgh.pa.us>
Permalink:  ../13853.1152021389@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13853.1152021389@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tometzky@batory.org.pl, pgsql-bugs@postgresql.org
  Subject: Re: query very slow when enable_seqscan=on
  In-Reply-To: <13853.1152021389@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox