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 1sGDd0-00AY5u-Sz for pgsql-general@arkaria.postgresql.org; Sun, 09 Jun 2024 08:10:15 +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 1sGDcy-003N5a-0x for pgsql-general@arkaria.postgresql.org; Sun, 09 Jun 2024 08:10:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sGDcx-003N1W-Fj for pgsql-general@lists.postgresql.org; Sun, 09 Jun 2024 08:10:12 +0000 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sGDcv-000RLL-LT for pgsql-general@lists.postgresql.org; Sun, 09 Jun 2024 08:10:11 +0000 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-627ea4869d1so2310667b3.2 for ; Sun, 09 Jun 2024 01:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717920609; x=1718525409; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dGQRTyG11FHb52majsSy6oGAXpvD9qXWysnH56clzfY=; b=QvpU0Vp0DVScms51ObnjMWmqYWanvbi160X2hRsTjOPn9MgA9vAa7wHLr635fi0aOe 61LPVxxOPmEFjr4RTS0an+UI3bHE7t3GJIvpvlpZjAo1BOrElj1eJzT9GulOSpQx+unt B80xk5Pz0vLvbqEj1V5wwhNZG98nSD3Ozp6uPIeE8FZVwJnFBFD1i0egj/1vjbg7MhnP qIP0UIoeOwO/TXCHso1E0Y9ftP1GtDwmpAZ56U4EJj2MYzytDYs0KB6ZVn/kM3hHUS43 d4P4ev5l9wqD6xZXRx98/+0WAunCrsnA3KtC+bYCQt7oZoYWYs2hoTj5yZZnwZOY0nwy QbYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717920609; x=1718525409; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dGQRTyG11FHb52majsSy6oGAXpvD9qXWysnH56clzfY=; b=KnVsUeOoZWm3csa8PWO9JYE6/+Cm6B+6RIjppLQMj2xM3J9DFd8a3dAyM1UEJeAfFA 4Be4gyQxeURducnhngwlOq7GJ7S58MnZ0ztWDNvD4VQApUupatvwOvKWKT5mh9S5XWeY ntXb0FvG6v+y4RoAKTdm67NhJkVolISN3ilbmJiH4zPQ9XhJLVD4SPPMZSlaeVqfFZ2k p3NF1CumGpSfWiJ2eQ1ihq32Mm/4B6DvlHOt9xr6emHlO2+9UUoEdlJYNL/xWuUrXGiP Es9JlUN353ldGvjqWdKS6sFrXoYwI7X4XOdVsvV81UbR5Ha48s1Qb0oTQRk7UiDZqh10 tHwA== X-Gm-Message-State: AOJu0YysgGZM02c1FEvqWK1pXouocLFyCZxbX67TvXSsmTLFwHdHVlqk +U1IZI18o9RM/qisP/dIFBsONItIoc/xw0MC1ae8Vpfz/HDUlTxVlN05+PK3vAwmvQmJrdDA/TV 51myVWqO5yRapPfaRTfT/oIYZ5WA= X-Google-Smtp-Source: AGHT+IEHKbZRc+Zk7izY3aq29pTIFYDXBD6pmpgOEmmLqKjJT2zpfRTkfxbkn6XVMDhk0NzGNiVQ2k5xlDCwiULZvZU= X-Received: by 2002:a0d:d4d1:0:b0:627:94c9:4857 with SMTP id 00721157ae682-62cd56e024cmr50681877b3.4.1717920608319; Sun, 09 Jun 2024 01:10:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Lok P Date: Sun, 9 Jun 2024 13:39:56 +0530 Message-ID: Subject: Re: Creating big indexes To: sud Cc: pgsql-general Content-Type: multipart/alternative; boundary="0000000000009c8292061a708f3d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009c8292061a708f3d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jun 9, 2024 at 10:39=E2=80=AFAM Lok P wrote: > > > On Sun, Jun 9, 2024 at 10:36=E2=80=AFAM sud wrote: > >> >> You can first create the index on the table using the "On ONLY"keyword, >> something as below. >> >> CREATE INDEX idx ON ONLY tab(col1); >> >> Then create indexes on each partition in "concurrently" from multiple >> sessions in chunks. >> >> CREATE INDEX CONCURRENTLY idx_1 ON tab_part1(col1); >> CREATE INDEX CONCURRENTLY idx_2 ON tab_part2(col1); >> >> After this step finishes the table level index which was created in the >> first step will be in valid state automatically. >> >> > Thank you so much. > Should we also tweak the parameters related to the parallelism and memory > as I mentioned in the first post? > Additionally ,is it also possible to drop the indexes also from the big partition table efficiently? To avoid the "transaction id wrap around" or "table bloat" when the index drop runs for longer duration? --0000000000009c8292061a708f3d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Jun 9, 2024 at 10:39=E2=80=AFAM L= ok P <loknath.73@gmail.com&g= t; wrote:


On Sun, Jun 9, 2= 024 at 10:36=E2=80=AFAM sud <suds1434@gmail.com> wrote:

=C2=A0You can first create the index on t= he table using the "On ONLY"keyword, something as below.

CREATE INDEX idx ON ONLY tab(col1);

Then create indexes on each partition in "concurrently" fr= om multiple sessions in chunks.

CREATE INDEX CONCU= RRENTLY idx_1=C2=A0 =C2=A0 ON tab_part1(col1);
CREATE INDEX CONCURRENTLY= idx_2=C2=A0 =C2=A0 ON tab_part2(col1);

After = this step finishes the table level index which was created in the first ste= p will be in valid state automatically.


Thank you so much.
Should we also t= weak the parameters related to the parallelism and memory as I mentioned in= the first post?=C2=A0

Ad= ditionally ,is it also possible to drop the indexes also from the big parti= tion table efficiently? To avoid the "transaction id wrap around"= or "table bloat" when the=C2=A0index drop runs for longer durati= on?
=C2=A0
--0000000000009c8292061a708f3d--