Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYhzp-00DQAs-4G for pgsql-admin@arkaria.postgresql.org; Fri, 17 Jan 2025 08:46:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tYhzn-00Bd2f-95 for pgsql-admin@arkaria.postgresql.org; Fri, 17 Jan 2025 08:46:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYhzm-00Bd2X-Su for pgsql-admin@lists.postgresql.org; Fri, 17 Jan 2025 08:46:27 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tYhzl-000u1E-05 for pgsql-admin@lists.postgresql.org; Fri, 17 Jan 2025 08:46:26 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-aaf3c3c104fso358459866b.1 for ; Fri, 17 Jan 2025 00:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1737103583; x=1737708383; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=UtItcZDGmE6klLStzStRDH9M5kHB9umVy0Qe6TGHy0k=; b=SOdaX4NB5cj8yigMLTJfsFujiIZKdKjvYZXdDK9iSULqJRJflIsiGaYbXm7J9Ps1ra 0Yr63wd7E/CJ3e34+N06yj1LypzfTaEOXbrA/YSL2zV68P+ORxaSyp2EW6WVbx1GsiGW Rk7qM22XXnnjTqzeXRDaHvcQXqBH4+i1gtwV2tXohw92aBedwoa8LI38XG3F/MlQ3ne3 SZc+x8f1vTmkRRvLH322xNJTXtCyRhEe0EGNEGeKDS4NfNXWm5rB9jXUx26nh/61E7gM IeroXjrcXXmr0iO0X1d51p4xBRyICYq9/8Bvkrdou4vb/FIZOWgPzbfP8/d7+6JBZqWg 08wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737103583; x=1737708383; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UtItcZDGmE6klLStzStRDH9M5kHB9umVy0Qe6TGHy0k=; b=GiOxNS0eyU8xKo09SzMHjzkErRgkzoHbgsV42nv3+gMmNBIyHKp6oFD/TUqt5sfScv s8gJ/CCYaESxrmdli3MPITAYX1vWA4rO3RiTeJ/QuvkOUYLCF9FPFzbpsGMyEHfPxs+9 rfiRy49uqwOGRkFAFApvcE3tABkGUvKoe2wfVjn53dkb/uMHyODFcGOx4pyCljafr6fJ P+4MCLfeiQfj4vu0B+Z7ojAuehv8Njkxa/EZzRoVXPrIfm264Z13uhXG4QgNv6BPeBjk oC6kyuNOHTtDbX9jDY5WyQxT7oIwM5qvTHFQRwgWVGll1okKcDi9OZyPRDawgWwUQ10M IHJQ== X-Forwarded-Encrypted: i=1; AJvYcCUWjHs/abRjntmiBLHFJnSXrBeZIdztxaF7ul45k0PyYyyDNQlx8e+aabPiSf5VLgR7vl76kUFxZ1e3Mg==@lists.postgresql.org X-Gm-Message-State: AOJu0YxaU9WmvSuSZFqjqC+UfsgZ+FqAZjtDT+1LPUc5ZtnSqhsok2/X /tAxUBKWli07PypkWpffR2CrsTPr7LLUKaypPCn3R/6gyC2hb1BQewHZ49uoO4c= X-Gm-Gg: ASbGncsNbJN8WU5+Y6aqxeq8EyndwzmPIrBfBQIpaNGcSO2gD6EtjKqxa/ZX3ZylTtl NZDud7x/SUWVLiFXVJe5aQKvluRz/hyPgdK6FQqMqWnrY01fTFPDxgmkrq7aQ7xXfgmW9yY3DXk Yzb8gIR2Ln4gyg2QU0e7IdxdrB+fbS9ORTCHx0s2t+k0JksX8RtPGaGh/Ty7dUmWsAPbEwCH1T5 g8YmIz+ZksrxFsECGMtR7Yvv4+Ic1GV5+cQykrLx0LwjcJOq/pWWNTECjAuOWJ0e67EgpaNDcDs X-Google-Smtp-Source: AGHT+IF2fqg45KTgMXI+1xOjz/MVhh+PUBMdmwXvkg1ixbbpmyk70ul45JC3T71qyGuvBRX4IEnsxA== X-Received: by 2002:a17:907:2d8f:b0:aae:c3c1:1361 with SMTP id a640c23a62f3a-ab38b37eb60mr170573366b.44.1737103583048; Fri, 17 Jan 2025 00:46:23 -0800 (PST) Received: from localhost.localdomain ([88.116.133.170]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384f86206sm132428166b.134.2025.01.17.00.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 00:46:22 -0800 (PST) Message-ID: <1bd0d7ac8f0ee3a38a55f960403e856ad0c9f82a.camel@cybertec.at> Subject: Re: vacuuming taking long time for pg_attribute From: Laurenz Albe To: Siraj G , Pgsql-admin Date: Fri, 17 Jan 2025 09:46:22 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-01-17 at 11:45 +0530, Siraj G wrote: > The PgSQL version is 16 and it runs in Cloud SQL managed by GCP. >=20 > Problem was that we were unable to conveniently=C2=A0get the object detai= ls in the > schema browser (within the Cloud SQL Studio) as it was getting timeout ag= ain > and again. Several application jobs start to fail. Eventually we found th= at > pg_catalog.pg_attribute was having tons of dead tuples. While vacuum on t= his > took several hours, the problem got resolved eventually. > Command ran: vacuum pg_attribute; >=20 > I would like to understand how this issue can be prevented. We do have > autovacuum ON and I could see the last vacuum on this table was just abou= t > 30hrs back.=C2=A0 >=20 > Appreciate any suggestions. I can only guess, but my guess is that you are creating temporary tables very frequently. Creating a temporary table insers the columns into "pg_attribute", and they get deleted again when the session ends. Perhaps autovacuum was just not fast enough, perhaps there were long-running transactions or queries that prevented autovacuum from cleanin= g up the dead rows in "pg_attribute". Make sure your transactions are short and that autovacuum is configured sufficiently aggressive. Yours, Laurenz Albe