Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D701EB5DBF0 for ; Wed, 10 Aug 2011 12:28:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 95830-03 for ; Wed, 10 Aug 2011 15:28:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 8283AB5DBDC for ; Wed, 10 Aug 2011 12:28:04 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 10 Aug 2011 10:28:02 -0500 Message-Id: <4E425D2D020000250003FD32@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 10 Aug 2011 10:27:57 -0500 From: "Kevin Grittner" To: "Grzegorz Blinowski" , Subject: Re: poor pefrormance with regexp searches on large tables References: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.711 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.811 X-Spam-Level: X-Archive-Number: 201108/120 X-Sequence-Number: 44567 Grzegorz Blinowski wrote: > Some performance params from postgresql.conf: Please paste the result of running the query on this page: http://wiki.postgresql.org/wiki/Server_Configuration For a start, the general advice is usually to start with shared_buffers at the lesser of 25% of system RAM or 8 GB, and adjust from there based on benchmarks. So you might want to try 4GB for that one. Just to confirm, you are using 2 Phase Commit? (People sometimes mistake the max_prepared_transactions setting for something related to prepared statements.) I concur with previous advice that using one regular expression which matches all of the terms is going to be a lot faster than matching each small regular expression separately and then combining them. -Kevin