Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XYJF4-0007yw-9a for pgsql-sql@arkaria.postgresql.org; Sun, 28 Sep 2014 18:30:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XYJF3-00085z-Aq for pgsql-sql@arkaria.postgresql.org; Sun, 28 Sep 2014 18:30:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XYJF2-00085k-GF; Sun, 28 Sep 2014 18:30:40 +0000 Received: from mail.fmed.uba.ar ([157.92.152.1] helo=azteca.fmed.uba.ar) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XYJEy-0003oz-2o; Sun, 28 Sep 2014 18:30:37 +0000 Received: from localhost (localhost [127.0.0.1]) by azteca.fmed.uba.ar (Postfix) with ESMTP id A50105CA077; Sun, 28 Sep 2014 15:30:23 -0300 (ART) X-Virus-Scanned: amavisd-new at fmed.uba.ar Received: from azteca.fmed.uba.ar ([127.0.0.1]) by localhost (azteca.fmed.uba.ar [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XfRBnnZ2eJif; Sun, 28 Sep 2014 15:30:17 -0300 (ART) Received: from azteca.fmed.uba.ar (azteca.fmed.uba.ar [157.92.152.1]) by azteca.fmed.uba.ar (Postfix) with ESMTP id 64BE05CA07D; Sun, 28 Sep 2014 15:30:15 -0300 (ART) Date: Sun, 28 Sep 2014 15:30:15 -0300 (ART) From: Gerardo Herzig To: pgsql-general@postgresql.org, pgsql-sql Message-ID: <796319273.990931.1411929015224.JavaMail.root@fmed.uba.ar> In-Reply-To: <784256159.990526.1411927128224.JavaMail.root@fmed.uba.ar> Subject: how to see "where" SQL is better than PLPGSQL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [186.136.211.207] X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - GC36 (Linux)/7.2.0_GA_2669) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Hi all. I see an entire database, with all the stored procedures writen in = plpgsql. Off course, many (if not all) of that SP are simple inserts, updat= es, selects and so on. So, i want to test and show the differences between doing the same function= in pgpgsql vs. plain sql. Im getting statistics (via collectd if that matters) and doing a modified v= ersion of the pgbench tests, just using pl (and sql) functions instead of t= he plain query: \setrandom delta -5000 5000 BEGIN; SELECT pgbench_accounts_upd_pl(:delta, :aid); SELECT get_pgbench_accounts_pl(:aid); SELECT pgbench_tellers_upd_pl(:delta, :tid); SELECT pgbench_branches_upd_pl(:delta, :bid); select pgbench_history_ins_pl(:tid, :bid, :aid, :delta); END; At first, pgbench is showing a difference between the "pl" and de "sql" ver= sions: (pl.scripts own the "PL" version, sql.script owns the "SQL" version of the = test) (This is a tiny netbook, with a dual core procesor) gherzig@via:~> pgbench -c 2 -C -T 300 -f pl.script -U postgres test duration: 300 s number of transactions actually processed: 13524 tps =3D 45.074960 (including connections establishing) tps =3D 75.260741 (excluding connections establishing) gherzig@via:~> pgbench -c 2 -C -T 300 -f sql.script -U postgres test starting vacuum...end. duration: 300 s number of transactions actually processed: 15125 tps =3D 50.412852 (including connections establishing) tps =3D 92.058245 (excluding connections establishing) So yeah, it looks like the "SQL" version is able to do a 10% more transacti= ons.=20 However, i was hoping to see anothers "efects" of using sql (perhaps less l= oad avg in the SQL version), at the OS level.=20 So, finnaly, the actual question: =C2=BFWich signals should i monitor, in order to show that PGPLSQL uses mor= e resources than SQL? Thanks! Gerardo --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql