Re: Planner: rows=1 after "similar to" where condition.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joris Dobbelsteen" <Joris(at)familiedobbelsteen(dot)nl>
Cc: "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Planner: rows=1 after "similar to" where condition.
Date: 2008-02-25 15:33:57
Message-ID: 27132.1203953637@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Joris Dobbelsteen" <Joris(at)familiedobbelsteen(dot)nl> writes:
> "Bitmap Heap Scan on log_syslog syslog (cost=11168.32..16988.84 rows=1
> width=221) (actual time=11145.729..30067.606 rows=212 loops=1)"
> " Recheck Cond: (((program)::text = 'amavis'::text) AND
> ((facility)::text = 'mail'::text))"
> " Filter: (((priority)::text = 'notice'::text) AND ((text)::text ~
> '***:^(?:amavis\\[[0-9]+\\]: \\([0-9]+-[-0-9]+\\) Passed [A-Za-z0-9]+,
> [][0-9\\.]* <[^<>]+> -> <[^<>]+>, Message-ID: <[^<>]+>,
> (Resent-Message-ID: <[^<>]+>, |)mail.id: [^ ,]+, Hits: [-+0-9\\.,]+,
> queued.as: [^ ,]+, [0-9]+ ms)$'::text))"

It's not too surprising that you'd get a small selectivity estimate
for such a long regexp; the default estimate is just based on the amount
of fixed text in the pattern, and you've got a lot.

If you increase the stats target for the column to 100 or more then it
will try actually applying the regexp to all the histogram entries.
That might or might not give you a better estimate.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hernan gonzalez 2008-02-25 15:43:49 Re: text and bytea
Previous Message Gregory Stark 2008-02-25 15:09:30 Re: text and bytea