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 1oIwm2-0005CV-5c for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 18:37:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIwm1-0008Tv-26 for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 18:37:45 +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 1oIwm0-0008Ta-Mm for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 18:37:44 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oIwlw-0004B5-Tj for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 18:37:43 +0000 Received: by mail-ot1-x334.google.com with SMTP id c20-20020a9d4814000000b0061cecd22af4so10717486otf.12 for ; Tue, 02 Aug 2022 11:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:to:content-language:from :subject:content-transfer-encoding; bh=/8besME97Z+SPLOq9/PTZJvVIYUTIPkMK4MdGDPAJPk=; b=F16m1mJXCr/VKBPSY/9u/FsZw2D+etwNs3OKfwjC/Y2FZzyZnPdlzLCvrL3bhPzBId nM/3gmDnsunJRgr2VVaPgOTl6zth6fCbzyK+VK6RWEMxeXRcgY20Zr7zh1f5BW95OetB +kNVW1A/3SKcCCc8VMQlBn2EorShXwCkidJ0pZYKLXIsC08gzGYkq8k0dvfmx0hEAKPW puAsYx0VhV0qh24LhrbUmEyMCiFZyaFJNhZFZvrbsJPJ0TL3UHjHbkfGQoxw7LL+vSPW uec6ik42LCQ1G+judeJlv2SkWCLXE+oKWQPQ5Nkf4tk02JsBcVaM7Drvs73IPbW2QJ2w MuLA== 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:to :content-language:from:subject:content-transfer-encoding; bh=/8besME97Z+SPLOq9/PTZJvVIYUTIPkMK4MdGDPAJPk=; b=8ABNbOMLf7nSVuuDf0a4m4FEVJm8ZvQubdLMIl2sv3AZZhCvhCSObjadicgbXYpx7C NRWhwvTemHUmZ/QQcTT2wo0Ch2/JwT0kYrSj7lsRNQPgR0VjiIbbEQh2rewnxxopfF70 axZqdn6u5jNG0JZ/KQw63LNTu4yxVPqAH75XPY3TLKAxvJtxotKbOf9Pp1aWfY+X3Sg+ zb1w7xSEFWZJGCIyhe3Vl/0WiQmDusWpw26bvJGaw3obGiXv/kjzw8MkDNaw/6Nf1t/n y/dWx100adUTOAW1UNNMsPaa7GxJk8bs38v8BsyWKdlh+Vititcex3TiXlPBJkHq+bgC OWlg== X-Gm-Message-State: AJIora8CwzP/pRwkBniOV40oOGcQAPpeJQGfmgjOrWko0yZ62/mw8Sym vTS5w0/1keSsBON4gRVQz576ZSk/HQo= X-Google-Smtp-Source: AGRyM1tdQcv977Ikwp7/mf98C2h4nZ0jAXYw7csU4bJntyIJfM4FyTlgzrNZBys6xG9iKOvfB9g9KA== X-Received: by 2002:a05:6830:925:b0:61d:1f55:57ce with SMTP id v37-20020a056830092500b0061d1f5557cemr8009635ott.78.1659465459951; Tue, 02 Aug 2022 11:37:39 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id e13-20020a0568301e4d00b0061c7f73611asm3519624otj.60.2022.08.02.11.37.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Aug 2022 11:37:39 -0700 (PDT) Message-ID: <5adcc923-889d-bb68-5a04-60125b6f0e96@gmail.com> Date: Tue, 2 Aug 2022 13:37:38 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 To: pgsql-general list Content-Language: en-US From: Ron Subject: Copying records from TABLE_A to TABLE_B (in the same database) Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk AWS RDS Postgresql 12.10 There are no indices or constraints (except for NOT NULL) on table_a. The two ways that I know are:     INSERT INTO table_a SELECT * FROM table_b; and     \COPY table_a TO '/tmp/table_a.tsv' WITH (FORMAT BINARY);     \COPY table_b FROM '/tmp/table_a.tsv' WITH (FORMAT BINARY); Is there a faster/better way? -- Angular momentum makes the world go 'round.