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 1lD5qK-0005uC-F8 for pgsql-performance@arkaria.postgresql.org; Fri, 19 Feb 2021 13:29:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lD5qI-0006L8-Hc for pgsql-performance@arkaria.postgresql.org; Fri, 19 Feb 2021 13:29:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lD5qI-0006L0-Av for pgsql-performance@lists.postgresql.org; Fri, 19 Feb 2021 13:29:10 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lD5qE-0002O2-JV for pgsql-performance@postgresql.org; Fri, 19 Feb 2021 13:29:09 +0000 Received: by mail-ej1-x632.google.com with SMTP id e13so10024130ejl.8 for ; Fri, 19 Feb 2021 05:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=QEdqJOSOc6uVbmrF1UaDxEdVK3oLagJkVJECEfva34g=; b=M9cMm6JjN8K5jIrBjOUKLUy8gqAnbaVfCUvAZXp6BIpRtd728Xxxy/UQO6URdLDeBC XDrqJDiS3EqgFT0YuYGsavE8iLJt8GZ4kMOEK4xR9qdXIvsL7G3GV79c1eVCWLp6P8xO XitYZalc8WA9oDHjekyJW2fTfFYR5ptksssWNWaJIzzirnRHyY2I2MArPaK9laEZXQy7 f0/YL/fojusYdTMhAtS2n5xVoML90jhNLUsUabzE6uJ61UWMR/Ml3DFI4JUGSnA6beCo mVU+Eg1e/XBDBRim+qpYOhxLR4d2dsZL5ZBeE16lv2FSvclvzbo8cpG1DgXt1BHEUz8S uKPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=QEdqJOSOc6uVbmrF1UaDxEdVK3oLagJkVJECEfva34g=; b=AALjcQ0UK8prgDZqsz2yX6ZCdeWX7yCq8oX+CoZ90p0NBjDiB1P96I3LcLsTrfXxIf 5f/MEPO6nq+EKUnQ5CWFsStN+92izBRYmsn+NkeZ2IfiwRt4lNRd4vgze8+Sq/uzDhmV /I/7MGqPbxjU0GWZNoeUGnsLa12zHhTZ1rbTBUNSJ7wGrvERgh8/YmY+qfFa8XHORkM1 De3RT2alNoWuRW0StCRBisUgCgAD2iK3y0XWsUtGv7/BYBYeu+XM1mFuvczs/wyRd8wE EzWIdwVeYkZfwfqS4UZfCt3PsQmC6OC6CRV+3baM24+AA9t3x1KQ/v7n//aEiehfyIxp p7cw== X-Gm-Message-State: AOAM531TfI+hwffd86A/rxfGe002Uq3LIoebi3vPLP7LShRbf6USu3dT dGS5x3pzg/I3brDeoA9dHy1Aow== X-Google-Smtp-Source: ABdhPJwMBZmcyxCDZx+Ps9Wu1LnXU3pRMVHtZN/i0igO+uWKnCUHORPupbkAVaTOf31r9sKe0c2sGw== X-Received: by 2002:a17:906:a099:: with SMTP id q25mr8664330ejy.549.1613741344918; Fri, 19 Feb 2021 05:29:04 -0800 (PST) Received: from localhost.localdomain (217-149-173-224.nat.highway.telekom.at. [217.149.173.224]) by smtp.gmail.com with ESMTPSA id h10sm5163868edk.45.2021.02.19.05.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 05:29:04 -0800 (PST) Message-ID: <96ac94b7d5f5be3e03e94f21253ae4220c01f0ee.camel@cybertec.at> Subject: Re: Autovacuum not functioning for large tables but it is working for few other small tables. From: Laurenz Albe To: M Tarkeshwar Rao , Michael Lewis , "pgsql-performance@postgresql.org" Cc: Ankit Sharma , Atul Parashar Date: Fri, 19 Feb 2021 14:29:03 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2021-02-19 at 10:51 +0000, M Tarkeshwar Rao wrote: > Please find the Vacuum(verbose) output. Can you please suggest what is the reason? > How can we avoid these scenarios? > > The customer tried to run the VACUUM(verbose) last night, but it was running > continuously for 5 hours without any visible progress. So they had to abort it > as it was going to exhaust their maintenance window. > > db_Server14=# VACUUM (VERBOSE) audittraillogentry; > INFO: vacuuming "mmsuper.audittraillogentry" > INFO: scanned index "audittraillogentry_pkey" to remove 11184539 row versions > DETAIL: CPU 25.24s/49.11u sec elapsed 81.33 sec > INFO: scanned index "audit_intime_index" to remove 11184539 row versions > DETAIL: CPU 23.27s/59.28u sec elapsed 88.63 sec > INFO: scanned index "audit_outtime_index" to remove 11184539 row versions > DETAIL: CPU 27.02s/55.10u sec elapsed 92.04 sec > INFO: scanned index "audit_sourceid_index" to remove 11184539 row versions > DETAIL: CPU 110.81s/72.29u sec elapsed 260.71 sec > [and so on, the same 6 indexes are repeatedly scanned] PostgreSQL performs VACUUM in batches of "maintenance_work_mem" size of tuple identifiers. If that parameter is small, the indexes have to be scanned often. Try increasing "maintenance_work_mem" to 1GB (if you have enough RAM), that will make it faster. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com