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 1jucyz-00027h-0H for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jul 2020 14:29:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jucyx-0002qz-N5 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jul 2020 14:29:31 +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 1jucyx-0002qs-CW for pgsql-hackers@lists.postgresql.org; Sun, 12 Jul 2020 14:29:31 +0000 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jucyq-0008JL-9Q for pgsql-hackers@lists.postgresql.org; Sun, 12 Jul 2020 14:29:30 +0000 Received: by mail-il1-x141.google.com with SMTP id s21so9034380ilk.5 for ; Sun, 12 Jul 2020 07:29:23 -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=gzHCltEY6W53bQUTZkOOMpatGLpIWFUKFthfobOVB1w=; b=sCbPzwpdMdXAY5oKjbYrPUSItdQ47ws96AJyrHNY/boV0132u983RaPX6na0xAqDK+ M+UVaxzbdu8XVJGzkJ2iQxKYRBcQ4XRtRmQnSA2iNtitKvax8wF3eE/2iqiuvoTxVhh9 fg4SztuS5fKzjAsNbbC04IFbo1a7hi228IgtKTgzBLXvrv1Q34Qnw7BASmyGTCneyhOy c1MSmdDlztDFJqIow+kL9NS3kRnS2xxEGW9PtAKDGGI3Dff4TprmuJyKSmp86ZzmHbOA VieTH4dsj75hDgG9y/dbwMMVZhObdQEXl1LDp6iqxegqbcYpnsv1se0deoVgKJjExLUH N2OQ== 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=gzHCltEY6W53bQUTZkOOMpatGLpIWFUKFthfobOVB1w=; b=cfP+oLHLTgDs4+H0GGMnWQhfSdpzVVXZeQ1CBO1rgDFHgdqKR4PAKqYK6uFJz+ELtV tRnyKIEYIoFPc4qS7nOejDuCJuY5amTtn1t28SqAfjqsB78W2CQskTYmy11FhbS/hyfm FnPs/pPk/YJes93HlRoQIZ9hj53mF1WvgbRZVxLTVrFvDlXbAnljznRxlSQoUsjdoH8u o9LEila+yVqsM9pT5OOlLIqhUx3YWSff9Jom0A4aDDd8deDkT72yQMTN4iF3UWqi8DDg OMCgtfl5IApo863USuvc+P/Dm0KsJOaPqgRJqiIOMWUvJlKzD186M1IyLLi+LDtxK9hT Yw7w== X-Gm-Message-State: AOAM530eCsY5rlJEM2Q+DTAqk2qWBK9cFCo8+SEjJTSjgXnn508Zb/de yjbnEkm+rhiL2zL6dV3XVl1djg== X-Google-Smtp-Source: ABdhPJx9GOUy4bhUiI6pn5xKlsfS7kdzu569SUH2ikS3QegUnMLM4LQ7oLWt3RHxb7Qbwwb4qYb4DQ== X-Received: by 2002:a92:cc4d:: with SMTP id t13mr15115139ilq.283.1594564163053; Sun, 12 Jul 2020 07:29:23 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v5sm6425696ios.54.2020.07.12.07.29.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jul 2020 07:29:22 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 4FB54800144; Sun, 12 Jul 2020 09:29:21 -0500 (CDT) Date: Sun, 12 Jul 2020 09:29:21 -0500 From: Justin Pryzby To: Julien Rouhaud Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Avoid useless retrieval of defaults and check constraints in pg_dump -a Message-ID: <20200712142921.GA26220@telsasoft.com> References: <20200712054850.GA92357@nol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200712054850.GA92357@nol> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Jul 12, 2020 at 07:48:50AM +0200, Julien Rouhaud wrote: > Currently, getTableAttrs() always retrieves info about columns defaults and > check constraints, while this will never be used if --data-only option if used. > This seems like a waste of resources, so here's a patch to skip those parts > when the DDL won't be generated. Note that the speed of default and constraint handling has come up before: https://www.postgresql.org/message-id/flat/CAMkU%3D1xPqHP%3D7YPeChq6n1v_qd4WGf%2BZvtnR-b%2BgyzFqtJqMMQ%40mail.gmail.com https://www.postgresql.org/message-id/CAMkU=1x-e+maqefhM1yMeSiJ8J9Z+SJHgW7c9bqo3E3JMG4iJA@mail.gmail.com I'd pointed out that a significant fraction of our pg_upgrade time was in pg_dump, due to having wide tables with many child tables, and "default 0" on every column. (I've since dropped our defaults so this is no longer an issue here). It appears your patch would avoid doing unnecessary work in the --data-only case, but it wouldn't help the pg_upgrade case. -- Justin