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 1sewbv-00Eatq-CF for pgsql-admin@arkaria.postgresql.org; Fri, 16 Aug 2024 13:03: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 1sewbt-00556k-Sv for pgsql-admin@arkaria.postgresql.org; Fri, 16 Aug 2024 13:03: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 1sewbt-00556U-FI for pgsql-admin@lists.postgresql.org; Fri, 16 Aug 2024 13:03:17 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sewbr-0059Xx-78 for pgsql-admin@lists.postgresql.org; Fri, 16 Aug 2024 13:03:16 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52fd0904243so349809e87.3 for ; Fri, 16 Aug 2024 06:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723813394; x=1724418194; 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=ttWTU9f6+GjX4wseUiq6a3xwqBwI5VMWtaL6y/sGZJM=; b=HMBLVXnTmwALcEMQuKXoLTKudwI+4WpmcLohNGGhYRG+cBryO8NeLeROq2jsPK4Fzs oBqKA9bj9JvsqfpQuqL7eOjKfyxriCeayBkbmVGzK9EnMf0Nu8WQdTzmjm01kpEbVbw6 swLFzHVQY+hKAJti0z1uvCs0wbe6rLfuYx6fkg1aLYrVYnrJgGZTRXJ3iySKSzCWV2C+ VATI+mcat7FE7X1FKp2FJo2tHSRyg4vZwGZ/8OUmoJb13Py4y72TqEwC/i/I42AyGdKy 1CnLGxCeDmvffV2UNcSg7pW07eDLLgn6/n7pVdAGM/tCpGXv1yEhVFFXcgv3eUBL92Ym oSLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723813394; x=1724418194; 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=ttWTU9f6+GjX4wseUiq6a3xwqBwI5VMWtaL6y/sGZJM=; b=cQ0eFtnrtZh23Tx/a/rRL7H1dHz0AplapTMJvecl/0kmc/OSdHyYsYng5wkzW//9ld K4NEkW8Zj/XGDa+7M59KXTooX3+6glK5njgUpy2iS0Q3rsHUUz1Jtmdag9qmurF8MShd oZGZXrOIT8nAo1EJaxxyitBDMZB3TCMA4scQ4ifKFfG9DCgOcNjqtB7qvVXUodvuV1Dv +926cF4zpfpsSWKnBGPGNE30r4Kyw5RlzKDZjJHRy4uMrKCjrZCwysmuX9FW74LO/cKx H951N0hh0wWx35AvgbYJMYnmojm1LzVBGt7Jd9q9BCfogGdMfaDX1UE6qhS/GVunGvrd 2Ecg== X-Forwarded-Encrypted: i=1; AJvYcCWlO/w5utVvwyHA5FnznnrsyKtPCkbftq2iZD+mOVDgi5FpG7KP+bmOXoaOsVTMBICqutuQulSq6uFW3ZYYZ9YjpK+PhruBj/Ev30IbCrDe6w== X-Gm-Message-State: AOJu0YxtTujgkfWImTTXTk78gX+dYW2V/Klp8X82Kk3IkWj7+WXnbHcd +hHIiAtzprGE6prQoWsfc0rBmkIludEwVaPebN9FET8f6a6YrsxtJU/MXyCDqUszTU3x2k9cgQs ck8U3aMCJKlTuV9sWneMpYW2ryun9L/1e X-Google-Smtp-Source: AGHT+IEYfUz7QIPtKZ4LExPQ/2M00/wisnzVMqHKSp3wmba5iu/DVPVeV9P1HpGEJ7ou8VFOrZE+J31GcnALeq1C5s4= X-Received: by 2002:a05:6512:3b1e:b0:52e:ccf4:c5e2 with SMTP id 2adb3069b0e04-5331c6e974emr1165403e87.8.1723813393784; Fri, 16 Aug 2024 06:03:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Gram Date: Fri, 16 Aug 2024 15:03:01 +0200 Message-ID: Subject: =?UTF-8?Q?Re=3A_Reindex_doesn=E2=80=99t_not_working_replica_nodes?= To: khan Affan Cc: Mohammed Afsar , pgsql-admin@lists.postgresql.org, pgsql-admin Content-Type: multipart/alternative; boundary="000000000000fee606061fcc9437" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fee606061fcc9437 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Mohammed If we are talking physical replication then the wall includes changes to index=E2=80=99s data. If we are talking logical replication the wall does n= ot include index changes. Med venlig hilsen Peter Gram S=C3=A6byholmsvej 18 2500 Valby Mobile: (+45) 5374 7107 Email: peter.m.gram@gmail.com On Fri, 16 Aug 2024 at 13.20, khan Affan wrote: > Hi Mohammed, > > PostgreSQL replication is based on replicating WAL (Write-Ahead Log) > records, which capture changes to data files such as inserts, updates, > deletes, and the creation of new tables. However, > > WAL does not include the physical structure of indexes. > > If you're encountering issues like zero rows being fetched from the > replica, it could be due to index inconsistencies or replication lag. To > ensure your read replica has updated indexes, you can promote the replica > to be the primary node, perform the REINDEX operation, and then revert th= e > roles, making the original primary node the primary again. > > Regards > Muhammad Affan > > On Wed, Aug 14, 2024 at 5:58=E2=80=AFPM Mohammed Afsar wrote: > >> Dear experts, >> >> >> We have initiated reindex on source db but it not replicated to replica >> db and we have having select query fetching with zero rows but data exit= ing >> on the table. >> Postgres 11.10 streaming replication >> >> Regards, >> Mohammed Afsar >> > --000000000000fee606061fcc9437 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Mohammed

If we are talking physical replication then the wall includes changes= to index=E2=80=99s data. If we are talking logical replication the wall do= es not include index changes.=C2=A0

Med venlig hilsen

Peter Gram
S=C3=A6byholmsvej 18= =C2=A0
2500 Valby
Mobile: (+45) 5374 7107
<= div>

=


On Fri, 16 Au= g 2024 at 13.20, khan Affan <bawag= 773@gmail.com> wrote:
Hi Mohammed,

PostgreSQL replication is based on replicati= ng WAL (Write-Ahead Log) records, which capture changes to data files such = as inserts, updates, deletes, and the creation of new tables. However,
=
WAL does not include the physical structure of indexes.

If you&#= 39;re encountering issues like zero rows being fetched from the replica, it= could be due to index inconsistencies or replication lag. To ensure your r= ead replica has updated indexes, you can promote the replica to be the prim= ary node, perform the REINDEX operation, and then revert the roles, making = the original primary node the primary again.

Regards
Muhammad Aff= an

On Wed, Aug 14, 2024 at 5:58=E2=80=AFPM Mohammed Afsar <vmdapsar@gmail.com> wrote:=
Dear experts,


We have initiated reindex on source db but it not repl= icated to replica db and we have having select query fetching with zero row= s but data exiting on the table.
Postgres 11.10 streaming = replication=C2=A0

Regards,
Mohammed Afsar
--000000000000fee606061fcc9437--