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 1mq6q2-0007Qa-Ab for pgsql-general@arkaria.postgresql.org; Thu, 25 Nov 2021 04:58:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mq6q0-000479-BX for pgsql-general@arkaria.postgresql.org; Thu, 25 Nov 2021 04:58:24 +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 1mq6q0-00046j-1I for pgsql-general@lists.postgresql.org; Thu, 25 Nov 2021 04:58:24 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mq6px-0005ha-SV for pgsql-general@lists.postgresql.org; Thu, 25 Nov 2021 04:58:23 +0000 Received: by mail-oi1-x22e.google.com with SMTP id t23so10095936oiw.3 for ; Wed, 24 Nov 2021 20:58:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=wCiBSsDodOueyQ19MScVCDQuZliMJ6vF/ZflW8RIpFU=; b=eboVeOTtAHBkpEsrTfws+csw1okSE992eHILHlDoPQpD/1oDna9XG1rAmirL6pK468 VoUfvNSl2wpN3GrZ0dJ/zYHr3oOjmTvi4A5bgfxvWVjprKPN9DNm72XpLC0858GOnRC7 tdIKdS17JshKg1azrc2sT8c9AK2EQCrc5yeKuzhCyuRYtW5g430vlZqVhD60da4POk6u hQQEfTFegYLANxVRClbGrHS0WnCTKxELYm9inJKhVBxb3pp/q4IjNLjABwMY5C1vUQhZ mWQE0Z9reYJbIT4oqQ6OLOYuNEL1/QozvkKGRyQk3z2kGyOT4Tqf63jbmT11xqQ49tH2 EGAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=wCiBSsDodOueyQ19MScVCDQuZliMJ6vF/ZflW8RIpFU=; b=6y26j6z/4RIotdwMUtonCp6W/ZDnbwKCvCFfsMjUFthUWOeA/UwWJoy9G4Sqg0lfqP HfGS8zwP+6yg4tCTRXqz+0xtYUqZPfB/Themux0rOSHaxNIuI6DgoH6URDYsGk75YsUH 0FserB8zDrvE+WDJxWJNuRyRCCax2DouL+0NLxvQIHxCuVOMuQI0tMdiekV85GCS7812 liA0FfKYodpmuC94kNqv0cTleudTZPWL5lqhDH3Kn5OIG/lim4b4DmHJMr+oqW+9r1+b /kRFXbqONGe9JgeAb+SzfD3Cbr4G3AEfBHU9Tyjos9oVThj/3Dl6KoOEFqFIA8mPngC8 lQAw== X-Gm-Message-State: AOAM531QlMBVMSiwIQIlZ/uPmc/SRW30s6SBuBwhi0S/AjKqo534j1G8 pCSZW0f0E22Fz4w3inwTVgL7LzmdbqI= X-Google-Smtp-Source: ABdhPJzevqXbr2Zl0RrY3TfKo/I4/x5D1oviGseIqawclgk5JsYSXfAIRZyBM8ZCWoK9eidukbwcmA== X-Received: by 2002:aca:1104:: with SMTP id 4mr12788429oir.143.1637816300854; Wed, 24 Nov 2021 20:58:20 -0800 (PST) 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 m5sm416960oim.45.2021.11.24.20.58.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Nov 2021 20:58:20 -0800 (PST) Subject: Re: Inserts and bad performance To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <19b129be-79c7-18ca-de3c-b6ca170e64cd@gmail.com> Date: Wed, 24 Nov 2021 22:58:19 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------247F420C5CB134F0DCED462A" Content-Language: en-US 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. --------------247F420C5CB134F0DCED462A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/24/21 1:15 PM, Godfrin, Philippe E wrote: [snip] > I dropped the unique index , rebuilt the other indexes and no change. IMNSHO, this is the worst possible approach.  Drop everything *except* the unique index, and then (if possible) sort the input file by the unique key.   That'll increase buffered IO; otherwise, you're bopping all around the filesystem. Using a bulk loader if possible would increase speeds -- Angular momentum makes the world go 'round. --------------247F420C5CB134F0DCED462A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 11/24/21 1:15 PM, Godfrin, Philippe E wrote:
[snip]
I dropped the unique index , rebuilt the other indexes and no change.

IMNSHO, this is the worst possible approach.  Drop everything except the unique index, and then (if possible) sort the input file by the unique key.   That'll increase buffered IO; otherwise, you're bopping all around the filesystem.

Using a bulk loader if possible would increase speeds

--
Angular momentum makes the world go 'round.
--------------247F420C5CB134F0DCED462A--