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 1mnFDm-0004OQ-I8 for pgsql-general@arkaria.postgresql.org; Wed, 17 Nov 2021 07:19:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mnFDl-0003do-Bc for pgsql-general@arkaria.postgresql.org; Wed, 17 Nov 2021 07:19:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnFDl-0003df-03 for pgsql-general@lists.postgresql.org; Wed, 17 Nov 2021 07:19:05 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mnFDi-0005DZ-JY for pgsql-general@lists.postgresql.org; Wed, 17 Nov 2021 07:19:04 +0000 Received: by mail-pj1-x1032.google.com with SMTP id p18-20020a17090ad31200b001a78bb52876so4485032pju.3 for ; Tue, 16 Nov 2021 23:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to; bh=FwQpwat3iUB8K7i5V6aC5+ef2kKkZykbGWIYpJkTnAo=; b=UlmzfWkCFYM7kDYL9DXhUNXE7uSgZPdD8WJd0npqtQoWl9u9uvbd3b1/3vXpjDWhoM +L5mquZhZyzVtgYXxpuZhFin/BZsxCdnAcf0FI9/HiZ3oLEXuOe3mWq/E9rGrpFT3waS Apy4yZGrZq07UqT8a5hBLYf+GmHyEuZKPkVionyn3fQ4d04ANC0G0bXXtuTwUXUt3upI /zRwYCBA9yFJpD7i9xqHcxcjh5borkM/5QcyX2jjtpJekqk2bk6R/aDPD/rYqcFoACRZ s/VkKYiGVcXQ8fXJXMc2tcLjDxbbQN6xgZadgPKAwHaiGoc9XLZj3fLzm5QyfnJgAHfx cWXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to; bh=FwQpwat3iUB8K7i5V6aC5+ef2kKkZykbGWIYpJkTnAo=; b=AEVBm7+L88nqhfnCqxPBGHB+AUXbC/XE0hmXtMUDIftOEPvhLzYOuhw/aknHGspeeK mYGKRhE4wGnxc/uPJMSgDJkvMM5ClajmwzKL1cKfYEtCcOr+j82+uA+qcXUhRXU03Jg6 oIFQ98b1g9n7dzxLMk42jlh+yG0AywxCoY01j0EmZWzNSywAQgNig/JuEfSd3jh2xvS6 Iu5dD0KvTf9cEtPqm2ma+42Nvb3KYA2+hRLSTOxN8eaEcfDFBWuxiF3J1VqvEgE4BugH w4u7qUW2bCdVzu5V2o4Cmqhavp+T1acIMCBJ+rgpkoVa84tQ20XocxZNYO8SwJ/bAGdX 4DlA== X-Gm-Message-State: AOAM531YbDQXI4xvcx2SywGfZOCbuSMykJmXtWivTcn4hta0yOwUNtYs v2i5a3B1F7ZjqkXFzmRDP1Ha4vhcWNw= X-Google-Smtp-Source: ABdhPJzqAHvsOhUE7Xi26Sib8vDvaZEobj091p+dkr+L9VgziZkBYaQTc+qy7QJP20BaPJLzN7Q1OA== X-Received: by 2002:a17:90b:3b8e:: with SMTP id pc14mr6700055pjb.129.1637133540657; Tue, 16 Nov 2021 23:19:00 -0800 (PST) Received: from ?IPV6:2405:6e00:1ef3:200:507b:609:63ce:3435? ([2405:6e00:1ef3:200:507b:609:63ce:3435]) by smtp.gmail.com with ESMTPSA id bt2sm4179501pjb.57.2021.11.16.23.18.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Nov 2021 23:19:00 -0800 (PST) Content-Type: multipart/alternative; boundary="------------9RtvwD5X9pYaDyryvk00Jgxy" Message-ID: <32c591d4-a8c4-f4eb-d45f-5084932e4059@gmail.com> Date: Wed, 17 Nov 2021 17:18:57 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: create all indexes and triggers in a schema after bulk load Content-Language: en-US To: depesz@depesz.com Cc: pgsql-general@lists.postgresql.org References: <06fbb436-d81b-4428-029c-91e6f1181ed5@gmail.com> <20211117071643.GA11260@depesz.com> From: Akheel Ahmed In-Reply-To: <20211117071643.GA11260@depesz.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------9RtvwD5X9pYaDyryvk00Jgxy Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit thanks. will give it a try On 17/11/2021 5:16 pm, hubert depesz lubaczewski wrote: > On Wed, Nov 17, 2021 at 05:13:35PM +1000, Akheel Ahmed wrote: >> Hi Group >> >> I am looking at doing a CDC-based upgrade using the following steps: >> >> >> 1. pg_dump schema on source, but exclude indexes and triggers >> >> 2. recreate schema on target >> >> 3. Do a full load from source to target >> >> 4. Recreate all the indexes and triggers on the target >> >> The migration will automatically switch from full load to CDC when all >> tables are fully loaded. >> >> Is there a way to just recreate all indexes and triggers using a separate >> pg_dump on source to capture the ddl and then run it on the target? > There is no need for separate pg_dump. > > Just dump once, with -Fc, or (better) -Fd, and then use pg_restore > -l/-L. > > depesz --------------9RtvwD5X9pYaDyryvk00Jgxy Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

thanks. will give it a try

On 17/11/2021 5:16 pm, hubert depesz lubaczewski wrote:
On Wed, Nov 17, 2021 at 05:13:35PM +1000, Akheel Ahmed wrote:
Hi Group

I am looking at doing a CDC-based upgrade using the following steps:


1. pg_dump schema on source, but exclude indexes and triggers

2. recreate schema on target

3. Do a full load from source to target

4. Recreate all the indexes and triggers on the target

The migration will automatically switch from full load to CDC when all
tables are fully loaded.

Is there a way to just recreate all indexes and triggers using a separate
pg_dump on source to capture the ddl and then run it on the target?
There is no need for separate pg_dump.

Just dump once, with -Fc, or (better) -Fd, and then use pg_restore
-l/-L.

depesz
--------------9RtvwD5X9pYaDyryvk00Jgxy--