Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6joF-0007vF-Iu for pgsql-performance@arkaria.postgresql.org; Mon, 23 Oct 2017 20:58:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e6joF-0003Yi-1S for pgsql-performance@arkaria.postgresql.org; Mon, 23 Oct 2017 20:58:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e6jmT-0008Nj-4Y for pgsql-performance@postgresql.org; Mon, 23 Oct 2017 20:57:05 +0000 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1e6jmQ-0003Ux-AC for pgsql-performance@postgresql.org; Mon, 23 Oct 2017 20:57:03 +0000 Received: by mail-lf0-x22f.google.com with SMTP id 90so21618569lfs.13 for ; Mon, 23 Oct 2017 13:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=mCnN06epmWmAwELBymPWlp5G4mvX18FuwkuY+5Y6Azs=; b=niitav7ToxluyYDvOm72Sbx+xYjd/1up7z2J+2cfoJ4VIbuquAONoALHJ+LwuvxqZ2 71CyjmTMEYd8VRuAi+JU1CFZL2KHitzmj8U45vB2Cy9AYgUaE4MJIH/iKdnaOggRG+7P shKwIIHdyCeuuba+izYEBpgrs56PY59f1L9fN6mgKP25fnLAA1rWHUWNgA0PRT8ZB2pc GfqqpRrmWel2wNfZHABcZk/zZhumu+ykX13Y4Nj0RElON36S/oa0DZS3UvY/5QT+unr8 W/NqIhH/RTpUJn1M1ZRBJC/kO0sF+x4y8XwAcL3wqJbUSfzQPXZ4YfED6sVKcEFEdEWg YY1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mCnN06epmWmAwELBymPWlp5G4mvX18FuwkuY+5Y6Azs=; b=MYvK7LRGKqh/4T8w9uN4XyxRJ3R2bvhK+PQPA5rvR5ydUN959KumqtJRf8pr5QZmtI BzumzTuOrC/nlmlZz0QqNd6S84Vrz2mzjXvD13D5vEWFEnoNF7sancBV7gHX2GiYEu/L GZO0SWLtxz8LptHbMUMxVAVsndhXufUrmIiTXfvarhlRr0oGepuKWNxQ1E3iHC0XNxwT GFqca6Xyucdpj4IvfdCW9A7P7yXdDvgyRDdhd976VOJYSg+MO3VPZEFvkZM/Rx/vlrHH mqSfYMYpzVVITMB64HaiN+pbZTSQtDYdfR7U3YyaCi3lYMG2K3DmBKtkWdGr/FWpoaDj iKkg== X-Gm-Message-State: AMCzsaWeU9zr/Enmx4jB8Hb21Nv17eIiIR5L7cNQmU8uTA/OI4fvtSxd /gVLu7S1o7g/rPdRvhUal0J5FvTbXnQ0CnKAxVBHryODTgWUaqSp3Fj4Js48UwpnATdat6SaWiB zEqbZm2Y4G5FG0OoQDyu/43FUmm0ouTFAJogr3PEDNCH31dcHeg1krKmk6jnzMlL/ZvncJTEd8Z Uyh4yQ/kVjXNFMXVEt X-Google-Smtp-Source: ABhQp+RMPhIu/Ffy11fcE9vAKm7DMRMAJIPVvChaaTjCaAZSi6MiC4LfCo7e2T+DyGykTNyxeHGIIw== X-Received: by 10.46.85.69 with SMTP id j66mr5658303ljb.137.1508792219509; Mon, 23 Oct 2017 13:56:59 -0700 (PDT) Received: from [10.137.2.17] ([78.11.31.130]) by smtp.gmail.com with ESMTPSA id i27sm2167488ljb.38.2017.10.23.13.56.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 13:56:58 -0700 (PDT) Subject: Re: postgresql tuning with perf To: Purav Chovatia , pgsql-performance@postgresql.org References: From: Tomas Vondra Message-ID: <83f4911f-432f-8725-8fff-887753654396@2ndquadrant.com> Date: Mon, 23 Oct 2017 22:55:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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 On 10/23/2017 09:19 PM, Purav Chovatia wrote: > Hello Experts, > > We are trying to tune our postgresql DB using perf. Can you share some of the perf reports, then? > 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. > It'd be nice if you could share more details about the structure of the table, hardware and observed metrics (throughput, ...). Otherwise we can't try reproducing it, for example. > 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. So how do you know the major events are WAL related? Can you share how you measure that and the measurements? > > 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. Well, that's hard to do when you haven't shared the report. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, 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