Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVXIC-0000EA-2K for pgsql-performance@arkaria.postgresql.org; Mon, 04 May 2020 09:21:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jVXIA-0008Eg-V9 for pgsql-performance@arkaria.postgresql.org; Mon, 04 May 2020 09:21:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVXIA-0008EZ-K3 for pgsql-performance@lists.postgresql.org; Mon, 04 May 2020 09:21:38 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jVXI7-0006Lp-1X for pgsql-performance@lists.postgresql.org; Mon, 04 May 2020 09:21:37 +0000 Received: by mail-qk1-x741.google.com with SMTP id q7so15875253qkf.3 for ; Mon, 04 May 2020 02:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PMEjv0M3zj5/Q/FY5pv2Ugsk/d2P7zqmT/mBzA+GjTY=; b=igcIIuX0R+FW3bI8Zvuv8ch0BIguKxCvfzOFCRbcdCtemNRxiKfN2nXbzGIUD8zLtg rEqmLEmT6cUHSkNMBlWUHHS12adxzcBwU7mUoFed0m9xIEsJ4CkA//CuF1V9I5KGIgyL 1BBNrJdBDIfWMcPTP8pU/wSc9dgX0jc2Tligm2e0L4dpnyTb9oJd/Qi68U8beO9EPSQM jSNudN9yy4j5jwkhHlM/COGb1Rt7etXZ7EIIoR3s/+ptMas5Nsj6CrVZXnkERknsjJTT BnXrqNsBmcl8rlQl5umBhPq+dqVU4i5UvGbrqhtXkXe3WXBJTxfagWOqP/zdBZlRq5x2 URyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PMEjv0M3zj5/Q/FY5pv2Ugsk/d2P7zqmT/mBzA+GjTY=; b=frUmsXhcXMZhv9FCMRrKdxjS3LmwkVz4Tuu73fvjGUoyODsNfppMOUnSjk7P/VZCnm 4mKTUsR6ELvN98XdrwKmiFZv7UJZXSNzIbRo2OWk/233ro4lVf9bSQvD7bnYayxkcmis Ilf4fGBDYAfe8RJwJ5ynCgDBwAys2u3R+TPdnvNviajFgqh3fxRrJBIBk3yOmbpddCiY CJ4jqDJYCwloVitpwoNm94JdUIxK1tB6wfzq+Mq87NfRDs39WxDzpOFoqyk226K4k/H6 SFHL8K/0kgf8Y9XMOfM/UsbW7iYn+ZDd3FWiwo+EG66Wxkc5kqYCV0reXjY/9gp+PfwD kh0Q== X-Gm-Message-State: AGi0PubzuaYTpGDScoOVJtc3l6U55g79qeXrNMcGGMbVP+grdW5AtqbS CBuCC3BD/omfSStEvOEfkpdngA== X-Google-Smtp-Source: APiQypK6Sz9PEwtdU7ypo/qIaATDKfe3b3qrBL4VVoBbKf8Q02Pr6TN49Rv6jgg8KnfmB7vDEcfAtw== X-Received: by 2002:a37:a649:: with SMTP id p70mr13697454qke.307.1588584093024; Mon, 04 May 2020 02:21:33 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id x5sm10159661qtm.81.2020.05.04.02.21.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 02:21:32 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 7D27D802CE0; Mon, 4 May 2020 04:21:30 -0500 (CDT) Date: Mon, 4 May 2020 04:21:30 -0500 From: Justin Pryzby To: Arya F Cc: Michael Lewis , pgsql-performance@lists.postgresql.org Subject: Re: 600 million rows of data. Bad hardware or need partitioning? Message-ID: <20200504092130.GN28974@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, May 03, 2020 at 11:51:44PM -0400, Arya F wrote: > On Sun, May 3, 2020 at 11:46 PM Michael Lewis wrote: > > What kinds of storage (ssd or old 5400 rpm)? What else is this machine running? > > Not an SSD, but an old 1TB 7200 RPM HDD > > > What configs have been customized such as work_mem or random_page_cost? > > work_mem = 2403kB > random_page_cost = 1.1 I mentioned in February and March that you should plan to set shared_buffers to fit the indexes currently being updated. Partitioning can help with that *if* the writes mostly affect 1-2 partitions at a time (otherwise not). On Wed, Feb 05, 2020 at 11:15:48AM -0600, Justin Pryzby wrote: > > Would that work? Or any recommendations how I can achieve good performance > > for a lot of writes? > > Can you use partitioning so the updates are mostly affecting only one table at > once, and its indices are of reasonable size, such that they can fit easily in > shared_buffers. On Sun, Mar 22, 2020 at 08:29:04PM -0500, Justin Pryzby wrote: > On Sun, Mar 22, 2020 at 09:22:50PM -0400, Arya F wrote: > > I have noticed that my write/update performance starts to dramatically > > reduce after about 10 million rows on my hardware. The reason for the > > slowdown is the index updates on every write/update. > > It's commonly true that the indexes need to fit entirely in shared_buffers for > good write performance. I gave some suggestions here: > https://www.postgresql.org/message-id/20200223101209.GU31889%40telsasoft.com