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 1jR1n3-0007FV-F3 for pgsql-general@arkaria.postgresql.org; Tue, 21 Apr 2020 22:54:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jR1mV-0002bi-PV for pgsql-general@arkaria.postgresql.org; Tue, 21 Apr 2020 22:54:19 +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 1jR1mU-0002bb-RQ for pgsql-general@lists.postgresql.org; Tue, 21 Apr 2020 22:54:19 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jR1mP-0001ON-UQ for pgsql-general@postgresql.org; Tue, 21 Apr 2020 22:54:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6C4985C01F5; Tue, 21 Apr 2020 18:54:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 21 Apr 2020 18:54:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=0 3ov03gx5R0w0uYWkrpK/eCGSpb8Ir/cHnoqxzMrk5Q=; b=Q4HVHOJEwylbAFNE5 jzgkokpu/kpK6QRlqMXbQ46Clpjh+m15xz2zW0a5X+5RCISPXf7aO3UQ8c9YCBDM DukLXwTam+tZIRaParqMXTWPs6ynZbBUcvH2MJnLiMGdL4TB7YyGUDnA+G8eBD6t 8NYRBHNkJMsYRTiGTe0A69BoBV/eh276RrA1Z2VFhylzhblyPzRnR4v9eglEvOkM djjTptXjjY1nqtlZIYCujkAKka6szCHLLQAnKa6QSOc8DCrduvNGaUXtC2mu6YE5 kB8/0QsqzIrumTc0oEYMrll5t2FiVXsumVfih6EPiTsVGE2+o54suZUWIoeUPWjZ r8UJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=03ov03gx5R0w0uYWkrpK/eCGSpb8Ir/cHnoqxzMrk 5Q=; b=zktfjGjZUeT19C4haINtViAml1NnXKUHTwqAWnxsg4lie9abgo4t/wjap x127qUk40FCyv6b6bNKWhO0SUr6Ml3ojXE86oTjnh8vMaom5sbeZ+uGI4TZgyFAR DrdQVFxZ7v8kvFKUkpakOfQ0EqZ+Qu6DwlWwfRZh60fvuqQj3lP7rlLKpv7U2/FH qLgtIClta0L9yOQt1aH+Y+oHddwBepy9HV4QB8EBesedglOkh5xl4OgfVnpTGR65 xuKmXzrtXv+7nodH6DXKzvRA/xiW0hG0JLbKRgzy7VoKA7A4TDW+y4/J4b9T2vG3 t4bnOYUrRgyqA6YQKOrHUszc/tplw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgeeigddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecukfhppeeljedruddufedrvddtjedrudefkeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrg hvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (97-113-207-138.tukw.qwest.net [97.113.207.138]) by mail.messagingengine.com (Postfix) with ESMTPA id 73A473280066; Tue, 21 Apr 2020 18:54:10 -0400 (EDT) Subject: Re: how to slow down parts of Pg To: Virendra Kumar , "pgsql-general@postgresql.org" , Kevin Brannen References: <932472069.554849.1587504761819@mail.yahoo.com> From: Adrian Klaver Message-ID: <655239f9-7ece-8f18-816b-68ed421d34e2@aklaver.com> Date: Tue, 21 Apr 2020 15:54:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <932472069.554849.1587504761819@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/21/20 2:32 PM, Virendra Kumar wrote: > Autovacuum does takes care of dead tuples and return space to table's > allocated size and can be re-used by fresh incoming rows or any updates. > > Index bloat is still not being taken care of by autovacuum process. You > should use pg_repack to do index rebuild. Keep in mind that pg_repack > requires double the space of indexes, since there will be two indexes > existing during rebuild processes. You sure about that? On Postgres 12: --2020-04-21 15:47:27.452 PDT-0DEBUG: plant1: vac: 5154 (threshold 1081), anl: 5154 (threshold 565) --2020-04-21 15:47:27.452 PDT-0DEBUG: autovac_balance_cost(pid=18701 db=25092, rel=26497, dobalance=yes cost_limit=200, cost_limit_base=200, cost_delay=2) --2020-04-21 15:47:27.452 PDT-0DEBUG: CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0 --2020-04-21 15:47:27.452 PDT-0DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGRESS, xid/subid/cid: 0/1/0 --2020-04-21 15:47:27.452 PDT-0DEBUG: vacuuming "public.plant1" --2020-04-21 15:47:27.504 PDT-0DEBUG: scanned index "p_no_pkey" to remove 5114 row versions --2020-04-21 15:47:27.504 PDT-0DETAIL: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s --2020-04-21 15:47:27.514 PDT-0DEBUG: scanned index "common_idx" to remove 5114 row versions --2020-04-21 15:47:27.514 PDT-0DETAIL: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.01 s --2020-04-21 15:47:27.515 PDT-0DEBUG: scanned index "genus_idx" to remove 5114 row versions --2020-04-21 15:47:27.515 PDT-0DETAIL: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s --2020-04-21 15:47:27.517 PDT-0DEBUG: "plant1": removed 5114 row versions in 121 pages --2020-04-21 15:47:27.517 PDT-0DETAIL: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s --2020-04-21 15:47:27.517 PDT-0DEBUG: index "p_no_pkey" now contains 5154 row versions in 31 pages --2020-04-21 15:47:27.517 PDT-0DETAIL: 5114 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s. --2020-04-21 15:47:27.517 PDT-0DEBUG: index "common_idx" now contains 5154 row versions in 60 pages --2020-04-21 15:47:27.517 PDT-0DETAIL: 5114 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s. --2020-04-21 15:47:27.517 PDT-0DEBUG: index "genus_idx" now contains 5154 row versions in 47 pages --2020-04-21 15:47:27.517 PDT-0DETAIL: 5114 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s. --2020-04-21 15:47:27.518 PDT-0DEBUG: "plant1": found 5154 removable, 5154 nonremovable row versions in 195 out of 195 pages --2020-04-21 15:47:27.518 PDT-0DETAIL: 0 dead row versions cannot be removed yet, oldest xmin: 9715 There were 256 unused item identifiers. Skipped 0 pages due to buffer pins, 0 frozen pages. 0 pages are entirely empty. CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.06 s. --2020-04-21 15:47:27.518 PDT-0LOG: automatic vacuum of table "production.public.plant1": index scans: 1 pages: 0 removed, 195 remain, 0 skipped due to pins, 0 skipped frozen tuples: 5154 removed, 5154 remain, 0 are dead but not yet removable, oldest xmin: 9715 buffer usage: 753 hits, 0 misses, 255 dirtied avg read rate: 0.000 MB/s, avg write rate: 30.586 MB/s system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.06 s > > Regards, > Virendra Kumar > -- Adrian Klaver adrian.klaver@aklaver.com