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 1oIxG4-0006d2-O9 for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 19:08:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIxG2-0005ce-Ua for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 19:08:46 +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 1oIxG2-0005cS-Hs for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 19:08:46 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oIxG0-0000P8-Bn for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 19:08:45 +0000 Received: by mail-pj1-x102e.google.com with SMTP id t22so6591115pjy.1 for ; Tue, 02 Aug 2022 12:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc; bh=mnq2IGrt0Dg+1h+3VOa71HKty705FUqAmRQUD3G/jZ8=; b=eedP4t2bWWZ9cNJ7oCbsiqGBYQvCx5Em7I4RbyRrbjcQ6JdRnUUPCp4kvxFaPr5You J0G+oCpqfX9AnxUEJci5tpLIRE0RlAu+TsEHGwa1pOYY2uaU7Eb9RNZ8ufMCzZbT1831 2Y/FYWEeApz3pjmHHp+zPyR7Y9NvmtjvfIuVbK71lZIAUhu9kioKIQ+i6JyeV1foabcU Ri5rkiDEJF9ufe47adBN4Im2kphwTLsS7y0rzz1gSmCsvvsfzAhnqVcYCz5Q2iRMKmU4 1J4e9+SUsMYZYGEQQfpGuaHEicawVD8923CRuEP7vkL6Vh+xN5cUoijlFyWhwGy+A80H mCVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc; bh=mnq2IGrt0Dg+1h+3VOa71HKty705FUqAmRQUD3G/jZ8=; b=ZVCGea19TGdgQi2MSZaQY2rQXPYB5Uvhm7AXcumCVAMplw7FzQ5vGxfm+hVNw/CHo/ Kdc21TUYBhSxVnEfapY6YR7V7gIZp0rr8LCiUYPA1l/U8UGW0TSRMVu0oNSsDvx9mJMy Oex65GaCYohvjJsXpA7t6Ezu7DJKqvLmGb/JGVcGteoSxCCGzNIdyJxGk1IKLgm+MFmb 20G3/sR6vATnYBwqir4QM0s1ZBzgL52l9FLQ7ELBHLxQlXz4MpdTc+qAXVOhRgUf10sD LCJiPB74J5Pa9IHLvRLqUPdGrxS+zVOFCeD4NwkqgG1WU6azVs7zms6MdDsJ37n823vk OuPg== X-Gm-Message-State: ACgBeo2jr+RkT107piWpoXUb/oyzC8lKoV7xfsP4R5nEyVKpqjm3NiqD +xwg2Ro0TlrCv4mYLYyaJFEw99T6liI= X-Google-Smtp-Source: AA6agR6sFtyA9akDWzWBTv+kEG5X0wqKlB46HnkJXPlHIUfQxytjQFwUR37EzoE5MZHRMBYndwzxfQ== X-Received: by 2002:a17:902:dac7:b0:16f:13c6:938d with SMTP id q7-20020a170902dac700b0016f13c6938dmr122125plx.11.1659467323094; Tue, 02 Aug 2022 12:08:43 -0700 (PDT) Received: from [10.128.56.11] ([155.98.131.3]) by smtp.gmail.com with ESMTPSA id q10-20020a170902daca00b0016d83ed0a2csm55709plx.80.2022.08.02.12.08.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Aug 2022 12:08:42 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------0YuGnE8lCU3kmO0MX2NCpo0C" Message-ID: Date: Tue, 2 Aug 2022 13:08:41 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Copying records from TABLE_A to TABLE_B (in the same database) Content-Language: en-CA To: pgsql-general@lists.postgresql.org References: <5adcc923-889d-bb68-5a04-60125b6f0e96@gmail.com> <3e06c774-e323-db92-0cea-8600e1155600@gmx.net> <6a0b6197-c0ce-f0a0-2b2f-18f2b6e9b0fa@gmail.com> From: Rob Sargent In-Reply-To: <6a0b6197-c0ce-f0a0-2b2f-18f2b6e9b0fa@gmail.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. --------------0YuGnE8lCU3kmO0MX2NCpo0C Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit >>> >>> Logical replication might be another option. >>> Although I am not sure if that is even possible inside >>> the samme database. >>> I know it's tricky inside the same server >>> (between different databases) >>> >>> >>> >> If you can get outside sql, the bulk copy facilities (CopyManager in >> java) is blindingly fast for me. > > ?? > I meant using tools other than sql (and psql).   I have java code using org.postgresql.copy package because straight insert was too slow for large numbers of rows. --------------0YuGnE8lCU3kmO0MX2NCpo0C Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Logical replication might be another option.
Although I am not sure if that is even possible inside
the samme database.
I know it's tricky inside the same server
(between different databases)



If you can get outside sql, the bulk copy facilities (CopyManager in java) is blindingly fast for me.

??

I meant using tools other than sql (and psql).   I have java code using org.postgresql.copy package because straight insert was too slow for large numbers of rows.

--------------0YuGnE8lCU3kmO0MX2NCpo0C--