Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzOcn-0007N2-Nr for pgsql-performance@arkaria.postgresql.org; Tue, 03 Oct 2017 14:56:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dzOcn-0007qI-Af for pgsql-performance@arkaria.postgresql.org; Tue, 03 Oct 2017 14:56:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dzOb1-0002Sb-BM for pgsql-performance@postgresql.org; Tue, 03 Oct 2017 14:54:55 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dzOay-0000Ek-3L for pgsql-performance@postgresql.org; Tue, 03 Oct 2017 14:54:54 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 5274946DF8; Tue, 3 Oct 2017 16:54:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id tXUH44-s9yNY; Tue, 3 Oct 2017 16:54:48 +0200 (CEST) Message-ID: <1507042486.2998.1.camel@cybertec.at> Subject: Re: Stored Procedure Performance From: Laurenz Albe To: Purav Chovatia , pgsql-performance@postgresql.org Date: Tue, 03 Oct 2017 16:54:46 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Purav Chovatia wrote: > I come from Oracle world and we are porting all our applications to postgresql. > > The application calls 2 stored procs,  > - first one does a few selects and then an insert > - second one does an update > > The main table on which the insert and the update happens is truncated before every performance test. > > We are doing about 100 executions of both of these stored proc per second. > > In Oracle each exec takes about 1millisec whereas in postgres its taking 10millisec and that eventually leads to a queue build up in our application. > > All indices are in place. The select, insert & update are all single row operations and use the PK. > > It does not look like any query taking longer but something else. How can I check where is the time being spent? There are no IO waits, so its all on the CPU. You could profile the PostgreSQL server while it is executing the workload, see for example https://wiki.postgresql.org/wiki/Profiling_with_perf That way you could see where the time is spent. PL/pgSQL is not optimized for performance like PL/SQL. Yours, Laurenz Albe -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance