Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1B0AAB5DBDC for ; Fri, 12 Aug 2011 12:25:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 75683-09 for ; Fri, 12 Aug 2011 15:25:34 +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 EB242B5D803 for ; Fri, 12 Aug 2011 12:25:33 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 12 Aug 2011 10:25:26 -0500 Message-Id: <4E44FF8C020000250003FE35@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 12 Aug 2011 10:25:16 -0500 From: "Kevin Grittner" To: "Grzegorz Blinowski" , Subject: Re: poor pefrormance with regexp searches on large tables References: <4E425D2D020000250003FD32@gw.wicourts.gov> <4E4276E8020000250003FD52@gw.wicourts.gov> <4E43992E020000250003FD9D@gw.wicourts.gov> 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/143 X-Sequence-Number: 44590 Grzegorz Blinowski wrote: > 2) changing long attribute storage to EXTERNAL gave 30% better > search time (but only on the first search - i.e. before data is > cached) That suggests that all of the following are true: (1) The long value was previously being compressed and stored in-line. (2) It's now being stored uncompressed, out-of-line in the TOAST table. (3) Following the TOAST pointers on cached tuples isn't significantly more or less expensive than decompressing the data. (4) The smaller base tuple caused fewer page reads from disk, even with the out-of-line storage for the large value. The first three aren't surprising; that last one is. Unless there is significant bloat of the table, I'm having trouble seeing why that first run is cheaper this way. Make sure your vacuum policy is aggressive enough; otherwise you will probably see a slow but steady deterioration in performance.. -Kevin