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 1otr8S-0005a0-5c for pgsql-general@arkaria.postgresql.org; Sat, 12 Nov 2022 14:05:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1otr8R-00038Y-17 for pgsql-general@arkaria.postgresql.org; Sat, 12 Nov 2022 14:05:27 +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 1otr8Q-00038K-Hc for pgsql-general@lists.postgresql.org; Sat, 12 Nov 2022 14:05:26 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1otr8O-0005lx-34 for pgsql-general@lists.postgresql.org; Sat, 12 Nov 2022 14:05:26 +0000 Received: by mail-wr1-x435.google.com with SMTP id l14so9892670wrw.2 for ; Sat, 12 Nov 2022 06:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=mkY7FKe8NfyuYBIedhDTPFOSEExJpD0Mq98HG2ftIJ8=; b=2wHOmipw5Gfu4yERGFKb++JPrlLkAsjobTxGhmQ4p3V9/qikskuPJemMIvNi+bxYDm 3PXLUzQ6j5B66RM6oxOmCXPGnqaxBk9j+pQTsoP4b0VtutKP66yE/ecLAuLZwqJqTj03 utisG/pZMzIF3TaGQixD0TC41XuFe/r7k1+NYkYysGLrUQLbtXBVttRfhFeRIjoRT7ez Ax6e926AbVUfX5JtdfzdYTTkvUBgO404umgoK2oy0hVUHysSAszN+Ar8uRArMVDcEtl/ gsqV+tHebdv585BaFIwqRKQWW2XlfxwK244G07jIj6L+cTuJzt9LVMKEJvpPUE2vdV+9 Fokg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mkY7FKe8NfyuYBIedhDTPFOSEExJpD0Mq98HG2ftIJ8=; b=5uvLkbINK1QLUsgiOvwXpo2ZSOuEZOwvnsh/qxBiZh789wbVw1boZqvkMdeleSWFaD VFVsdVFxl5B/vuRp8JbJh70Q6exjoW8xsYF/sN+oM9OEktIftpE6Inm3FUM2Rl4Rpqu5 kW0hWGDXaoNtNA27APDfEvE9WF0oHxOeWp90OZZED2JwXdRJSub91gAtxxWQNbGOgTlm D9fVvAR7lSTdU0We/C+Ji1GvO6X4tD+P3y8Eaa/AdrNnbfejD7qHC7ZogDfpBu6B4JLs P0mBATvsTThJUfr8hevs3eiiUm+C3EEAiNi7s/tlVDXz8qdpwUjNu74E5gijbISVNE4/ k5Kg== X-Gm-Message-State: ANoB5plMu7xXOqQudDZFd7dBG3hbXgqRcuEe9jcY2PZKdMjqVJTjFlU3 m91Ki5+XdqjVCwWKC8ys2rOzqQ== X-Google-Smtp-Source: AA0mqf7xmyBqqzzxeS1WLCi7IC4TPkSjTVYg1URklPzkdDTqI7efSo/TvFpLU19L1+H5mgxL8/vHeA== X-Received: by 2002:adf:ec8f:0:b0:236:ae0d:e833 with SMTP id z15-20020adfec8f000000b00236ae0de833mr3505935wrn.155.1668261921981; Sat, 12 Nov 2022 06:05:21 -0800 (PST) Received: from localhost.localdomain (178-190-174-173.adsl.highway.telekom.at. [178.190.174.173]) by smtp.gmail.com with ESMTPSA id bp11-20020a5d5a8b000000b002366eb01e07sm4445865wrb.114.2022.11.12.06.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 06:05:21 -0800 (PST) Message-ID: <17e33debb7ec47f662cb7281718d8446544d29f0.camel@cybertec.at> Subject: Re: Table : Bloat grow high From: Laurenz Albe To: Alexis Zapata , "pgsql-general@lists.postgresql.org" Date: Sat, 12 Nov 2022 15:05:21 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2022-11-11 at 17:09 +0000, Alexis Zapata wrote: > In postgresql 13.5 I have a table (size 3.1 GB) and in this table occurs near to > 200 updates per second, after 2 days the size table is 7 GB and bloat grow to 45% and >  the query operations are degraded. vacuum runs every 5 seconds over this. but the > bloat growth continues, to solve the > problem quickly, we have made a replica of the table with a trigger, then a copy > of the data and in a > transaction we rename the table, but it would not be the best solution. > Some suggestion about stop this size increase or parameter to setting up? You'd be most happy with HOT updates. Make sure that there is no index on any of the columns you update, and change the table to have a "fillfactor" less than 100. Then you can get HOT updates which don't require VACUUM for cleaning up. https://www.cybertec-postgresql.com/en/hot-updates-in-postgresql-for-better-performance/ Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com