Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6iG0-0001FH-DA for pgsql-performance@arkaria.postgresql.org; Mon, 23 Oct 2017 19:19:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e6iFz-0005xk-EN for pgsql-performance@arkaria.postgresql.org; Mon, 23 Oct 2017 19:19:27 +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 1e6iFy-0005wF-7S for pgsql-performance@postgresql.org; Mon, 23 Oct 2017 19:19:26 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1e6iFv-00036V-6t for pgsql-performance@postgresql.org; Mon, 23 Oct 2017 19:19:25 +0000 Received: by mail-wm0-x230.google.com with SMTP id b189so11442250wmd.4 for ; Mon, 23 Oct 2017 12:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=kwahKjE4XF0QqR7No4btmqRYDYiPOMjXlkwOXVl2PL8=; b=BVwJNZB8nvk6mlAPsB5bwM7/xx3L79GXZ/DQvXdiqTJA+9dxAMxH9Q3/tg6/EY14nf Ikvh5Bvqpp+geK6Y/3bW1cMLjuyRPG21mqWTpzO46+YfmZl3ufrJs/HGpKEY4hBe1lHq CXkfkJWBhvPFwWDRcGLRLoRDJ/dVuMMscLDab5uVPjhJ5jCLDKCLg2lqKYVc5ntkyFSk GY0tLBksL7VZlUsj009RUrJPbimI80njahcddg04szEMKw9PDPwXjSPGaAl/k0wL0rha Ktw0TW67GxAFGCYnXUkF5jPZxk0tsEj9EOHkPgKpvcENpDx+Nv/ivFDDirSJlSKX3liC emOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=kwahKjE4XF0QqR7No4btmqRYDYiPOMjXlkwOXVl2PL8=; b=ImNTrZ1dSg6j/ITEZbqhSr+enI/YXm11a1NFh58cBYxuere/368MMN3vrHxsY9+NSy 2SOQUT0SUG4MPISql7tm1tbF4fGIldaug8WkU/L+uKl0v5YrNtI/BMcf8GnQKglfU5f8 ntK4dLxtPyTKOLYZyeKi3xiNZIu/5j+MvlwT1n7hg9wowP5NYDCJW1BzpyYz0H4/2zeI /TSXncbc7K6QUw7fo1HIhyxFaEJ3z41VfCx+wTp4valy305NJW1IlF3HIboiXSvErAo9 YudGOspFtqEf8i9sqERcOTl/guKWSPNzybwJrNNr2FxhlhqqzLHfXWAOuxNN/tm524WO GYmg== X-Gm-Message-State: AMCzsaXvUG+jRkO4+51KSqJ8zKOFGSsC7c5QbkJ2VtD1ASKxtkhMn5Qu 1LadjSeDuwNB3FBKt1Jr2lnqK6G3cInu9Y2xGVUAHw== X-Google-Smtp-Source: ABhQp+SAHeSQ83T/nlWe87BnPYD3+lCX9nxYkiif+eMZWfKauCZDX986XBIiSuefGiuYxJIDuLIR6E8UqPFGrf+3U3Q= X-Received: by 10.28.167.77 with SMTP id q74mr5783209wme.53.1508786360530; Mon, 23 Oct 2017 12:19:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.197.78 with HTTP; Mon, 23 Oct 2017 12:19:20 -0700 (PDT) From: Purav Chovatia Date: Tue, 24 Oct 2017 00:49:20 +0530 Message-ID: Subject: postgresql tuning with perf To: pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary="001a114b83f40fbf77055c3bb3d9" 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 --001a114b83f40fbf77055c3bb3d9 Content-Type: text/plain; charset="UTF-8" Hello Experts, We are trying to tune our postgresql DB using perf. We are running a C program that connects to postgres DB and calls very simple StoredProcs, one each for SELECT, INSERT & UPDATE. The SPs are very simple. *SELECT_SP*: CREATE OR REPLACE PROCEDURE query_dept_new(p1 IN numeric, p2 OUT numeric,p3 OUT numeric,.......,p205 OUT numeric) AS BEGIN SELECT c2,c3,......,c205 INTO p2,p3,.......,p205 FROM dept_new WHERE c1 = p1; END; *UPDATE_SP*: CREATE OR REPLACE PROCEDURE query_dept_update(p1 IN numeric, p2 IN numeric,........,p205 IN numeric) AS BEGIN update dept_new set c2 = p2,c3 = p3,.....,c205 = p205 WHERE c1 = p1; commit; END; *INSERT_SP*: CREATE OR REPLACE PROCEDURE query_dept_insert(p1 IN numeric, p2 IN numeric,.....,p205 IN numeric) AS BEGIN insert into dept_new values(p1,p2,.....,p205); commit; END; As shown above, its all on a single table. Before every test, the table is truncated and loaded with 1m rows. WAL is on a separate disk. Its about 3x slower as compared to Oracle and major events are WAL related. With fsync=off or sync_commit=off it gets 10% better but still far from Oracle. Vacuuming the table does not help. Checkpoint too is not an issue. Since we dont see any other way to find out what is slowing it down, we gathered data using the perf tool. Can somebody pls help on how do we go about reading the perf report. Thanks & Regards --001a114b83f40fbf77055c3bb3d9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Experts,

We are trying to tune ou= r postgresql DB using perf. We are running a C program that connects to pos= tgres DB and calls very simple StoredProcs, one each for SELECT, INSERT &am= p; UPDATE.=C2=A0

The SPs are very simple.=C2=A0
SELECT_SP:
CREATE OR REPLACE PROCEDURE query_dept_= new(p1 IN numeric, p2 OUT numeric,p3 OUT numeric,.......,p205 OUT numeric) = AS
BEGIN
=C2=A0 =C2=A0 SELECT c2,c3,......,c205
=C2=A0 =C2=A0 =C2=A0 =C2=A0 INTO p2,p3,.......,p205
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 FROM dept_new
=C2=A0 =C2=A0 =C2=A0 =C2=A0 WHERE= c1 =3D p1;
END;

UPDATE_SP:
=
CREATE OR REPLACE PROCEDURE query_dept_update(p1 IN numeric, p2 I= N numeric,........,p205 IN numeric) AS
BEGIN
=C2=A0 =C2= =A0 update dept_new set=C2=A0 c2 =3D p2,c3 =3D p3,.....,c205 =3D p205=C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 WHERE c1 =3D p1;
commit;
END;

<= /div>
INSERT_SP:
CREATE OR REPLACE PROCEDURE = query_dept_insert(p1 IN numeric, p2 IN numeric,.....,p205 IN numeric) AS
BEGIN
insert into= dept_new values(p1,p2,.....,p205);
commit;
END;

As shown a= bove, its all on a single table. Before every test, the table is truncated = and loaded with 1m rows. WAL is on a separate disk.

Its about 3x slower as compared to Oracle and major events are WAL relate= d. With fsync=3Doff or sync_commit=3Doff it gets 10% better but still far f= rom Oracle. Vacuuming the table does not help. Checkpoint too is not an iss= ue.=C2=A0

Since we dont see any other way to find = out what is slowing it down, we gathered data using the perf tool. Can some= body pls help on how do we go about reading the perf report.=C2=A0

Thanks & Regards
--001a114b83f40fbf77055c3bb3d9--