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 1pAhjU-00042K-Ac for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Dec 2022 01:29:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pAhjT-0006I4-5t for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Dec 2022 01:29:19 +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 1pAhjS-0006HU-UO for pgsql-bugs@lists.postgresql.org; Thu, 29 Dec 2022 01:29:18 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pAhjM-000549-DW for pgsql-bugs@lists.postgresql.org; Thu, 29 Dec 2022 01:29:17 +0000 Received: by mail-io1-xd36.google.com with SMTP id e129so582250iof.3 for ; Wed, 28 Dec 2022 17:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=tDOqG9SjikQhpfGJ2vWB8OBRl3MiatHdijSw8HeOrLE=; b=JTktVjDf92N1E+FHD5yj38DBVHaTsbYUdMv+SfloDNZnLSY+uq67Ofu3vtSH1oeOpb PMKZHFHjfq8i1U03YKTWTiXtKahVkwUzFaXyrQQAATz4s5Bg4yzu0hir6HcRr8kwN7Ms zf71Gq7TH6hFBfoJqMR1W8HNeAwAKmEGWZ30i8zKUPZWC31iExyzbg0fa+GVd9Ds4IMv Qt6/osi5HFCJgWpM1sDE2//l4+YuaddaQyN+ND+tppxSOXS9DkGzr+fLUWxSvdXFd1Qu o/wt6O1KFOm2y48pGZpolXkhFGXFs1MlSc/HxNk4Wr62r7RYoC6sX2KpHDpDizboF00R YcFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tDOqG9SjikQhpfGJ2vWB8OBRl3MiatHdijSw8HeOrLE=; b=FSyjO1jFNY0Be2X5yXWgwfPjp0AfTjJPsT7F9S0sn8flCISqBeQqOmX4d+ifWmnVLt w/vZ3Bt/Ne7FpooF+Rvl1Ywj+hlp1AEHIvw9lNTaxMnpK+KAzOI8fKSQ3JSbKsDRcj/r vea4Ijhlsd3PcayTVNHNPk6Ujs+F5fuOYIDnzLurw5QEmNWF+3tnA4GRVtws6emiXpcR A9tVkHYV3kiSGWkTCSSABXKbAiZNvWe1SbcxCkqMlZUK7iKim2uvo4SzXVENxEgCSujC iUL8Z3zJw/swZDip7Wid1t9924uc5RFftYI3+ljL3Sxnk4V8UR7runpFF2l7gW6Rl20b EpgA== X-Gm-Message-State: AFqh2koSaWMBjul7KW2LIxbxMCisWm/e40448pIV/suzeb2Bgpm9jwDI AfKbqflwqlvcnnzyORDdVQLW5g== X-Google-Smtp-Source: AMrXdXvptma3dyXVKbKI/i9YlsjtQNR3OgtzU3i2tHQSSB5UIfQeHczwh5C70RM8l65FecXI6xsA3A== X-Received: by 2002:a5e:9e0d:0:b0:6df:dc79:a1f2 with SMTP id i13-20020a5e9e0d000000b006dfdc79a1f2mr17489308ioq.11.1672277351690; Wed, 28 Dec 2022 17:29:11 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y16-20020a056e02129000b0030bff5524eesm3427956ilq.50.2022.12.28.17.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 17:29:11 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 5B441801319; Wed, 28 Dec 2022 19:29:10 -0600 (CST) Date: Wed, 28 Dec 2022 19:29:10 -0600 From: Justin Pryzby To: Michael Paquier Cc: Tom Lane , postgresql@taljaren.se, pgsql-bugs@lists.postgresql.org, Peter Geoghegan Subject: Re: BUG #17717: Regression in vacuumdb (15 is slower than 10/11 and possible memory issue) Message-ID: <20221229012910.GG1153@telsasoft.com> References: <17717-6c50eb1c7d23a886@postgresql.org> <3439037.1671130590@sss.pgh.pa.us> 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: Archived-At: Precedence: bulk On Sun, Dec 18, 2022 at 11:21:47AM +0900, Michael Paquier wrote: > On Thu, Dec 15, 2022 at 01:56:30PM -0500, Tom Lane wrote: > > * To fix vacuumdb properly, it might be enough to get it to > > batch VACUUMs, say by naming up to 1000 tables per command > > instead of just one. I'm not sure how that would interact > > with its parallelization logic, though. It's not really > > solving the O(N^2) issue either, just pushing it further out. > > I have been thinking about this part, and using a hardcoded rule for > the batches would be tricky. The list of relations returned by the > scan of pg_class are ordered by relpages, so depending on the > distribution of the sizes (few tables with a large size and a lot of > table with small sizes, exponential distribution of table sizes), we > may finish with more downsides than upsides in some cases, even if we > use a linear rule based on the number of relations, or even if we > distribute the relations across the slots in a round robin fashion for > example. I've always found it weird that it uses "ORDER BY relpages". I'd prefer if it could ORDER BY age(relfrozenxid) or GREATEST(age(relfrozenxid), age(relminmxid)), at least if you specify one of the --min-*age parms. Or something less hardcoded and unconfigurable. -- Justin