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 1pwqXo-00049G-Ma for pgsql-admin@arkaria.postgresql.org; Wed, 10 May 2023 20:36:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pwqXn-0001pe-0T for pgsql-admin@arkaria.postgresql.org; Wed, 10 May 2023 20:36:15 +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 1pwqXm-0001pV-JE for pgsql-admin@lists.postgresql.org; Wed, 10 May 2023 20:36:14 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pwqXe-001qPr-Mb for pgsql-admin@lists.postgresql.org; Wed, 10 May 2023 20:36:13 +0000 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-b9e2b65d006so11441081276.3 for ; Wed, 10 May 2023 13:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683750965; x=1686342965; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zK+IX9NQt7gjjDXOxwXovClbd1X5nGt0ttTnEPK1QaM=; b=bvUHRphXXr4g69VDCksgrIJicQ/RxtIZU6Pam8u+uWG0fiQgQxC8oymky2fNbBLFmG Lgve0VtsQZuZwvS85CPHRkXC2bFWdA9k3ndmkAj9HAdTV59FRhSlZprMLnyD6virPFRg F4qJ1hDU1R73ZNA8UkMvHTWyGctsxNh0eqeVmrkIidstEw4nHumSx/A3gg+AcY/YPYp3 NGQq1QyWyKAwskg/UYsjIM1OD0lxp3SjQlQudj9OtGGSWykf20YKdPc1O+3zTFEyHtdw XG/55uFun0e5nAIEzep9ApynqjI1boePBi2ERGisx1sM6mXrWp5R1nyoNJw/ebOP2/dD mSSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683750965; x=1686342965; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zK+IX9NQt7gjjDXOxwXovClbd1X5nGt0ttTnEPK1QaM=; b=Ms636h34+4jahQq6lo5AkBwAOriHF6VeWy90B6UyGtcnS6oqLezJMjnCgW4jexRd4k zH0XlkJYVBBYT6Z+WiUkiKTHGsr9XqVixKKEdhgByDymoArk3WH9RtQbWzSifawtS9iB CoxlQgfpzHHiJtn5Q2Uh6RjRpWIz26ACmPNjbEktXbncbrkKVNU/ZNn3R/oV+XSS+Vx7 FfLOvvQrTHSwn9sp45Oz9Qza50X+u8nmygZurBeXerOY5BKUhVdyNI+GbzCD8xbsouTX j1DAAHIohQKrViOv8LsMs7/EFRZsvnnbPdJ8C2eIlNPXqVrDrohM12m0kI12ZZ/8Ocno ssGw== X-Gm-Message-State: AC+VfDxGnlg1uv2WwWB3PA1ipureQfk8cDcb4IF52fXoVE28skfE/NKI gG1JSKrpRaynp1XhNSLmSKnxuBN6QQ8= X-Google-Smtp-Source: ACHHUZ4FBibUikSWbFTNY4Sfpl4CRbZLGapxEPlZ4tS9nhhnmKwZXtiM7Bp13zoLYkssHgGmNSDYag== X-Received: by 2002:a05:6902:102d:b0:b9a:66b7:673e with SMTP id x13-20020a056902102d00b00b9a66b7673emr24982209ybt.43.1683750964650; Wed, 10 May 2023 13:36:04 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:8c2c:5f08:4395:8de4? ([2600:1700:bd2c:b810:8c2c:5f08:4395:8de4]) by smtp.googlemail.com with ESMTPSA id 2-20020a251202000000b00b9db62abff3sm3956577ybs.58.2023.05.10.13.36.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 May 2023 13:36:04 -0700 (PDT) Message-ID: <5ec087d5-e07c-e704-96cd-a3f8fb9f91d7@gmail.com> Date: Wed, 10 May 2023 15:36:02 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Index recreation details with REINDEX TABLE CONCURRENTLY Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: <87ild0p6d4.fsf@gmail.com> From: Ron In-Reply-To: <87ild0p6d4.fsf@gmail.com> 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 On 5/10/23 10:04, Matthew Planchard wrote: > Hello, > > We're working on setting up some regular jobs to reindex tables where we > wind up generating a lot of index bloat. We're planning on using REINDEX > ... CONCURRENTLY. We'd like to reindex all of the indexes on the tables. > > In some of our environments, these tables are very large and under high > load, and we want to minimize the resource consumption of index > recreation if possible. > > With that in mind, my question is: does REINDEX TABLE CONCURRENTLY > operate on the indexes of the table in parallel, or sequentially? If > in parallel, I imagine we would see less DB resource utilization by > updating one index at a time. https://www.postgresql.org/docs/11/sql-createindex.html The CREATE INDEX page certainly mentions parallel index builds.  It would definitely be very good to know whether REINDEX TABLE CONCURRENTLY can have multiple "threads" leveraging table data already in cache so as not to have to reread the whole table each time. That (concurrent CREATE INDEX statements) really sped things up Back In The Day). -- Born in Arizona, moved to Babylonia.