Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 756189FA19C for ; Sat, 2 Dec 2006 21:31:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 61944-05 for ; Sat, 2 Dec 2006 21:31:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 0DDF19FA0EE for ; Sat, 2 Dec 2006 21:31:47 -0400 (AST) Received: from 10.10.1.93 ([10.10.1.93]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Sun, 3 Dec 2006 01:31:44 +0000 Received: from localhost.localdomain by mail.g2switchworks.com; 02 Dec 2006 19:31:38 -0600 Subject: Re: Regex performance issue From: Scott Marlowe To: Alexandru Coseru Cc: Heikki Linnakangas , pgsql-performance@postgresql.org In-Reply-To: <024601c71675$81277560$3cb16956@alex> References: <030b01c71651$984577c0$8300a8c0@tridecap.com> <01ea01c71653$438254e0$3cb16956@alex> <4571F856.7090808@enterprisedb.com> <022c01c7165f$17f49e80$3cb16956@alex> <4571FFA6.6070804@enterprisedb.com> <024601c71675$81277560$3cb16956@alex> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 02 Dec 2006 19:31:37 -0600 Message-Id: <1165109498.25316.15.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 (2.2.2-5) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/22 X-Sequence-Number: 22078 On Sun, 2006-12-03 at 02:53 +0200, Alexandru Coseru wrote: > Hello.. > > Thanks for the tip , i think i have got the ideea.. > > I'm too tired too , and i will try it tommorow. > > > Anyway , anybody has a clue why this regex is that CPU intensive ? I did > not saw the light on my drives blinking , and also vmstat doesn't yeld any > blocks in or out... > And how can it be optimized ? I think it's just that you're running the regex across 5400 or so elements. at 850 or so milliseconds, that comes out to 150uS for each comparison. I'd say it's just the number of comparisons that have to be made that's killing you here.