Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJN94-0006ga-Aw for pgsql-performance@arkaria.postgresql.org; Tue, 10 Sep 2013 12:34:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VJN93-0000kS-Oy for pgsql-performance@arkaria.postgresql.org; Tue, 10 Sep 2013 12:34:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJN92-0000jK-GN for pgsql-performance@postgresql.org; Tue, 10 Sep 2013 12:34:12 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJN8v-0005Lg-Pt for pgsql-performance@postgresql.org; Tue, 10 Sep 2013 12:34:12 +0000 Received: from intern.anarazel.de (unknown [82.113.99.216]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 8F8774E8003; Tue, 10 Sep 2013 14:34:03 +0200 (CEST) Date: Tue, 10 Sep 2013 14:20:36 +0200 From: Andres Freund To: Andrew Dunstan Cc: Jeff Janes , Josh Berkus , Amit Kapila , "pgsql-performance@postgresql.org" Subject: Re: Performance bug in prepared statement binding in 9.2? Message-ID: <20130910122036.GF1024477@alap2.anarazel.de> References: <51A699E6.3000008@agliodbs.com> <51A79512.4020200@agliodbs.com> <51FAA1B8.6040809@agliodbs.com> <522E69F1.8070203@dunslane.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <522E69F1.8070203@dunslane.net> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi, On 2013-09-09 20:38:09 -0400, Andrew Dunstan wrote: > > On 08/01/2013 03:20 PM, Jeff Janes wrote: > >On Thu, Aug 1, 2013 at 10:58 AM, Josh Berkus wrote: > >>Amit, All: > >> > >>So we just retested this on 9.3b2. The performance is the same as 9.1 > >>and 9.2; that is, progressively worse as the test cycles go on, and > >>unacceptably slow compared to 8.4. > >> > >>Some issue introduced in 9.1 is causing BINDs to get progressively > >>slower as the PARSEs BINDs get run repeatedly. Per earlier on this > >>thread, that can bloat to 200X time required for a BIND, and it's > >>definitely PostgreSQL-side. > >> > >>I'm trying to produce a test case which doesn't involve the user's > >>application. However, hints on other things to analyze would be keen. > >Does it seem to be all CPU time (it is hard to imagine what else it > >would be, but...) > > > >Could you use oprofile or perf or gprof to get a profile of the > >backend during a run? That should quickly narrow it down to which C > >function has the problem. > > > >Did you test 9.0 as well? > > > This has been tested back to 9.0. What we have found is that the problem > disappears if the database has come in via dump/restore, but is present if > it is the result of pg_upgrade. There are some long-running transactions > also running alongside this - we are currently planning a test where those > are not present. We're also looking at constructing a self-contained test > case. > > Here is some perf output from the bad case: > > + 14.67% postgres [.] heap_hot_search_buffer > + 11.45% postgres [.] LWLockAcquire > + 8.39% postgres [.] LWLockRelease > + 6.60% postgres [.] _bt_checkkeys > + 6.39% postgres [.] PinBuffer > + 5.96% postgres [.] hash_search_with_hash_value > + 5.43% postgres [.] hash_any > + 5.14% postgres [.] UnpinBuffer > + 3.43% postgres [.] ReadBuffer_common > + 2.34% postgres [.] index_fetch_heap > + 2.04% postgres [.] heap_page_prune_opt A backtrace for this would be useful. Alternatively you could recompile postgres using -fno-omit-frame-pointer in CFLAGS and use perf record -g. Any chance you have older prepared xacts, older sessions or something like that around? I'd expect heap_prune* to be present in workloads that spend significant time in heap_hot_search_buffer... Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance