Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uinqw-00G1F0-Vk for pgsql-admin@arkaria.postgresql.org; Mon, 04 Aug 2025 05:35:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uinqv-00G6lZ-Ty for pgsql-admin@arkaria.postgresql.org; Mon, 04 Aug 2025 05:35:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uinqv-00G6lR-If for pgsql-admin@lists.postgresql.org; Mon, 04 Aug 2025 05:35:17 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uinqt-000dog-1U for pgsql-admin@lists.postgresql.org; Mon, 04 Aug 2025 05:35:17 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-2ff9b45aec2so2243533fac.2 for ; Sun, 03 Aug 2025 22:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754285714; x=1754890514; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=V4yZqJjJSIwaa08JyeAGwqt6Nf9Xd1ijQSkU27qM/co=; b=aHKOqi6AiB1nSBZ7ekmhAVSPrI1OSa2CtjWfKt4oql91Ay1ryIy/qJv5G5mkUDTm2z LoVyaLUrcjYKCJANNmTlB4SvUW2aBXXuNkeWy8Mf8ZsqN7vHNA89u4AwizHhTVEK02uw UGoM8bxeamUDsYLvRmql3Tyqbqhtx9P4BKHoAYYt2/6YeDrs4xKzqzs+2D19eLVS0dO6 qJCwQDhOEJN98r2gsKh80iLv7vUtY65YglKacAPfHwJpOrKEGjok81CdYHjPcxmZST0C hzAJ38fhDptXQOIcJq/mCFLTVO4yj7pPOCVYcTNEf9DonJnDnyc4Rnift077wEmnUXjj TRgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754285714; x=1754890514; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V4yZqJjJSIwaa08JyeAGwqt6Nf9Xd1ijQSkU27qM/co=; b=sZx/j+Jl6//olZLIN1Gz6+dJeDxJmkCfjgQslSoh9j6gvdQKEM+p9NKxHMmpC0/HKm T0Z5s/4cY/Gq0I3gntguNpJamUv482sAddXS9vBL4Ipk98Jfv1vrDpXPJsp7V/iMN2nV ZGNdizJtGFSXNo3/cfdY5setJxncDCBiKDBHR2zVrUrzCI+UQIHauIOWhpuAHZ/uut0l Qpr0RBda9OZ7/QpU+u5gkwRrU+voJCrm784hbvvNEpz3Zp5OQTP8e4XzslqQe8hmKaa2 D4Qnj5hCel3/IJzrq/7CEbWsW5S+lTph6gaMFVxe65YZGSEiU1BtIYcDw8oL1D7zZSiw WRpg== X-Gm-Message-State: AOJu0YwHv+tF4sN8d9wqUhvE2yOWQmLOsXc2skIBc0IZEQ0kt0Jw90Ur n8fjeTavn1e4P7zot9bOzXPZ88hjgUUBtUdgmkfRtA95RU/3AUlhKzxjjo0G3sh1K+9xahiLxG/ a7KG9h+PRzo6CbP4JtcZEFZbDML7Bm/M= X-Gm-Gg: ASbGncuuZ89VIFsBnSKr0QcwYVx+vs/eyR2WuQZi1BlyNOtPdM4SDYUNoMW/cqlP8T6 VtKtHU2DxK8C5xlvPwsh0uqUG6l0WGWMTfgLRvngEabpr0nkrKR2PGKiXmchGFNwMAD+BSjmGQ7 266YUo6aK70Bqg9q1JxvJV9pVYl24WMDNGsKpsjTkl4MIa4QldqoIYczd5KDxcw++Udmeeiojuq ofo7hWgXBEKuEQ7QAxUX/A2bQR9A7Q0vuQdQLXv X-Google-Smtp-Source: AGHT+IGZDXJ7n2ArbqTfsjtyrhFIoj0Ue2TblXlNsYhSbYgnQbSeA2uq4omcF084pKTDoUdJXmQxA6yBn7eCMT9S9z0= X-Received: by 2002:a05:6870:452:b0:302:5dba:5ae0 with SMTP id 586e51a60fabf-30b679939fdmr4204189fac.20.1754285713898; Sun, 03 Aug 2025 22:35:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a8a:5e6:0:b0:5dc:d940:7893 with HTTP; Sun, 3 Aug 2025 22:35:13 -0700 (PDT) In-Reply-To: References: From: "David G. Johnston" Date: Sun, 3 Aug 2025 22:35:13 -0700 X-Gm-Features: Ac12FXyzmKSla1nBC8EDFiE-wWi28pbJz8MNF2GqDb_CXgpz5Roa-YDz6vjTi5Q Message-ID: Subject: Re: Indexing Strategy for Partitioned Table in PostgreSQL 15.13 To: Mahesh Shetty Cc: "pgsql-admin@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000cfc232063b83781a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cfc232063b83781a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sunday, August 3, 2025, Mahesh Shetty wrote: > > I have a large partitioned table with around 100 partitions, and we're > planning to add an index to it. I'm a bit concerned about the potential > impact and duration of the indexing process, > It will end very quickly=E2=80=A6 > and I=E2=80=99d appreciate your inputs on the following: > > 1. > > If I run CREATE INDEX CONCURRENTLY on the *parent table*, will it > automatically create indexes concurrently on all its partitions? > > Sometimes it=E2=80=99s best to just try (I didn=E2=80=99t though)=E2=80= =A6but the answer is explicitly documented (see create index) Concurrent builds for indexes on partitioned tables are currently not supported. However, you may concurrently build the index on each partition individually and then finally create the partitioned index non-concurrently in order to reduce the time where writes to the partitioned table will be locked out. In this case, building the partitioned index is a metadata only operation. David J. --000000000000cfc232063b83781a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sunday, August 3, 2025, Mahesh Shetty <maheshetty20@gmail.com> wrote:

I have a large partitioned table with around 100 partitions, and we'= re planning to add an index to it. I'm a bit concerned about the potent= ial impact and duration of the indexing process,


It will end very quickly=E2=80=A6=C2=A0

and I=E2=80=99d= appreciate your inputs on the following:

  1. If I run CREATE INDEX CONCURRENTLY on the parent ta= ble, will it automatically create indexes concurrently on all its = partitions?

Sometimes it=E2=80= =99s best to just try (I didn=E2=80=99t though)=E2=80=A6but the answer is e= xplicitly documented (see create index)

Concurr= ent builds for indexes on partitioned tables are currently not supported. H= owever, you may concurrently build the index on each partition individually= and then finally create the partitioned index non-concurrently in order to= reduce the time where writes to the partitioned table will be locked out. = In this case, building the partitioned index is a metadata only operation.<= /span>

David J.

--000000000000cfc232063b83781a--