Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBnNE-0003XA-2z for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Apr 2019 21:24:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hBnNC-0005BR-Ln for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Apr 2019 21:24:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBnNC-0005B5-9U for pgsql-hackers@lists.postgresql.org; Wed, 03 Apr 2019 21:24:42 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBnN9-0004Cs-3D for pgsql-hackers@lists.postgresql.org; Wed, 03 Apr 2019 21:24:41 +0000 Received: by mail-io1-xd29.google.com with SMTP id v4so174113ioj.5 for ; Wed, 03 Apr 2019 14:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=REzJv9En9myW514tQvSYZ6mRv4IXOEn2Z5cByJwtFmI=; b=mJQyUyyF8TmIpiodus8b+e73XZMEP3Rkp26uED+2wbSXDn/mSeL+5nSuhSTpVGqXeT BQ01mk9irvdYIVeFmYpLtF0yb83qeAPTehDJyv6flqqZZGZqtZqI94ne/WkRjeNvSRKp 1/AsodbOhci1BVMoLdh3ULbbctX8G+6I8tI48FSN/JzDlTf17cGNUt1URpCY1uvDvvKh 6V+bH96AfIzdiqOz3j0crpvjqZmX9+3KNEcfEW/vP/T6d06ojrWWfkHxArwGpNuIyQFu R7aBzupoXmYFRkkvS96LX31PK9w5EoTALupfsS0C3BmnqSbgQpXD/FDyuP5/1MTvycQN 8JnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=REzJv9En9myW514tQvSYZ6mRv4IXOEn2Z5cByJwtFmI=; b=R4xI7yg5lWC+UP1tiVlwfXlmHSkw3bndoE6hhcp0Qsks3Jy55hKEpVYIJH+MLlPEmW UO++KlYoPelEHAwQ8sn1lMN9ucP28FgBKXgyYWXmAoah9VxXwak3MYrQNJUxtRAG9Jlk 9A5fPDcoMV0ZVy0Y2Z+42W58DehMghyEEoH7fLA28bNr38jJm/sqL1GjT6vYX7W6E2xh 3uDV9+yeeup38fFkxoQ9DDY608foCYLy1OSlrmR4s0bBhRmTz7klxY0VTmQvauXLMdI3 tm5yk8VAmacrc5VcgYEX53iopFoLnJATNDAS1Eq6kkJgywLiASO2etjXI/M4sDIx782W eQWQ== X-Gm-Message-State: APjAAAXdK+7e4m+XdhJ4rgKhaiIpFY9khVw63ESBZj9eXhO3vGHQSEiT AKuMDnvcAdbvFgqpHlzWjX6WBw== X-Google-Smtp-Source: APXvYqzIZgzrk0S3fJ/zbpUcgvMdpWVR8FYlnhRqV4SHnysCIkgYihecrvgbyQn9WBwOq3ghgM2Myw== X-Received: by 2002:a5d:88ca:: with SMTP id i10mr1727565iol.261.1554326677107; Wed, 03 Apr 2019 14:24:37 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id f8sm9316466itc.27.2019.04.03.14.24.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 14:24:36 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id C9569800B7B; Wed, 3 Apr 2019 16:24:34 -0500 (CDT) Date: Wed, 3 Apr 2019 16:24:34 -0500 From: Justin Pryzby To: Jeff Janes Cc: Peter Eisentraut , Tom Lane , Jesper Pedersen , Robert Haas , "Jamison, Kirk" , Alvaro Herrera , Michael Paquier , "fabriziomello@gmail.com" , "pgsql-hackers@lists.postgresql.org" , Bruce Momjian Subject: Re: pg_upgrade: Pass -j down to vacuumdb Message-ID: <20190403212434.GY17544@telsasoft.com> References: <201902010958.cf2cbi3d2ule@alvherre.pgsql> <03845f77-49e7-4569-7062-8ee1fb460ec2@redhat.com> <30470.1553551070@sss.pgh.pa.us> <2c054085-0b68-c049-d6d8-8b74852b4c73@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Apr 03, 2019 at 04:42:14PM -0400, Jeff Janes wrote: > So maybe the first stage could > be run by pg_upgrade itself, while the new server is still running on a > linux socket in a private directory. I think that would take too long. It would be less of an issue if there was feedback/progress from pg_upgrade during the analyze. For our upgrades (which typically take ~15min but several customers take up to ~60min), I only analyze base tables (essentially, those which are neither parents nor children), then start services, then ANALYZE with default stats target. I would want to avoid delaying services restart for more than another (say) 5 minutes, and I would want to avoid even that unless there was a progress report indicating that it's projected to take only a few more minutes. I just did a test on one of our large-but-not-huge customers. With stats_target=1, analyzing a 145GB partitioned table looks like it'll take perhaps an hour; they have ~1TB data, so delaying services during ANALYZE would nullify the utility of pg_upgrade. I can restore the essential tables from backup in 15-30 minutes. It might be fine if pg_upgrade took an option which enabled analyze, perhaps instead of outputting analyze_new_cluster.sh. But actually, a problem with *that* is that currently pg_upgrade avoids starting the new cluster. That seems to be deliberate, since, with --link, that's an irreversible operation: it's unsafe to start the old cluster afterwards. Tangent: I have a queued mail from ~15 months ago wherein I proposed adding to pg_upgrade an option to remove the old data dir (or probably only the files associated with known relations). I realized at the time that would be pretty scary without having first verified that the new cluster at least starts. I'm not sure how good an idea that is, but --startnewcluster would be needed there, too. Justin