Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Johnston" <polobo(at)yahoo(dot)com>
Cc: hamann(dot)w(at)t-online(dot)de, pgsql-general(at)postgresql(dot)org
Subject: Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results
Date: 2012-12-23 17:55:06
Message-ID: 27093.1356285306@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"David Johnston" <polobo(at)yahoo(dot)com> writes:
>> while it might work to reverse the order in a regex, I have experienced
>> severe slowdown when the pattern comes from table data

> If it is indeed related to the custom reverse query the fact that you are
> going through an SQL wrapper to access a c-level function is inevitably
> going to degrade performance.

I believe that in most situations of interest, the SQL wrapper would get
"inlined" and thus create no significant per-row penalty. It's possible
this isn't happening in some specific case, but as you say we'd need to
see a concrete example to know one way or the other.

Another point that comes to mind is that "pattern comes from table data"
probably means "query uses a whole lot of different patterns over its
lifetime". Each different pattern is going to require regex
compilation, which is not a particularly cheap operation.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-12-23 19:38:08 Re: downgrading a database
Previous Message Tom Lane 2012-12-23 17:16:44 Re: Insert Assertion Failed in strcoll_l.c:112