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 1pXhpt-0004gD-92 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 12:15:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXhpr-0007Tn-JL for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 12:14:59 +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 1pXhpr-0007Qj-8A for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 12:14:59 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXhpo-0000iI-Pm for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 12:14:58 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1720433ba75so17809373fac.5 for ; Thu, 02 Mar 2023 04:14:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fdJQXL7cdqFTwbxulBaqr+LFwZ3ve15R8mRGxj3lDHI=; b=YTvHEdBLX+UL8tYM9ZDq+e63GZa+YoKAuvuv1F5bZZEiA/rfVxvxJxgTPSbFV3o7V9 m6kSXQ5mHnH15Q0mj7q7ntlPUgp9U5eKvHBAEwMRFiWegQR610vmhngnOlQpUl/Js1oY nW15TVB6XiTxesbvsi6jJNUwN8Xlw+nFylp88+Y0JTQQ9SPaAXY6ejxe7gEuIfP+QMhU iEHgcoQsdgcLo2Te0Zuuea6eci3KcWbaMYstg59F+7blrVvS9I9xS7yWJnpl99ca2pMN j7KssZOpXHfOuCSGgZYg0xhN9rFmewG+OQO1soniBUFLYJCTeyGZ4SBmkUmnJ93TYfS+ 51bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=fdJQXL7cdqFTwbxulBaqr+LFwZ3ve15R8mRGxj3lDHI=; b=ZCZr10PWmkaEujpwvdGC+G/4ANx9Jf3KM6Y9d5/KPr5VJifnNO31fRoLSkRcAKbON1 KC2jl4AEpGp9VfyQoRyvLK7p2IB5p0w48qoOi/6dxcU5xNVuqy+5o52EZi7hNQs4UZy5 tFYtUiaQLI5AnOjVjFJGg5l3cSB6dorttT8ApNu+bYoGAdZ5Bc0xO+v4VM+bP7NkLxeU rWXXBzhmZq82KA806UFnZVruz2DStr5cq/08dknvflyfyyapJtdlup7ISyhwMOs+0CWl H2Q+pArfM1dWQ0k62MUyLytzoQ3auAY+r9DYMcEGa1fx53FqFWXojNZ4h6zHlx5QLx3m Ezyg== X-Gm-Message-State: AO0yUKUKVx95o61UzSn8X/NiHBm3crWQECr+tHrJv4DaVoxFZzVc25oo zz8aFBEw5SoTjHygxz+0UcxAvyKK4FGqz18TMKM5uxheyuPByg== X-Google-Smtp-Source: AK7set89+yo0puXWLtFcWiRuy65/ZLvmqQ36CtX+ERSDBa4I4ZlZRHi8ozHzmO2xulKYvVgGBDERpzgKTnrvcml9nf8= X-Received: by 2002:a05:6870:1a82:b0:176:2299:dce3 with SMTP id ef2-20020a0568701a8200b001762299dce3mr1829574oab.10.1677759295993; Thu, 02 Mar 2023 04:14:55 -0800 (PST) MIME-Version: 1.0 References: <20221206184756.2fdpd4epvyftutoe@awork3.anarazel.de> <3466340.1673117404@sss.pgh.pa.us> <20230109200347.ps43ri7llrxusgu5@awork3.anarazel.de> <4184492.1673296630@sss.pgh.pa.us> In-Reply-To: From: Amit Kapila Date: Thu, 2 Mar 2023 17:44:44 +0530 Message-ID: Subject: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher To: =?UTF-8?B?w5ZuZGVyIEthbGFjxLE=?= Cc: "shiy.fnst@fujitsu.com" , "wangw.fnst@fujitsu.com" , Marco Slot , Tom Lane , Andres Freund , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 2, 2023 at 3:00=E2=80=AFPM =C3=96nder Kalac=C4=B1 wrote: >> >> Few comments: >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> 1. >> + identity. When replica identity FULL is specifie= d, >> + indexes can be used on the subscriber side for searching the rows. T= hese >> + indexes should be btree, >> >> Why only btree and not others like a hash index? Also, there should be >> some comments in FindUsableIndexForReplicaIdentityFull() to explain >> the choices. > > > I updated the comment(s). > > For a more technical reference, we have these restrictions, because we re= ly on > RelationFindReplTupleByIndex() which is designed to handle PK/RI. And, > RelationFindReplTupleByIndex() is written in a way that only expects > indexes with these limitations. > > In order to keep the changes as small as possible, I refrained from relax= ing this > limitation for now. I'm definitely up to working on this for relaxing the= se > limitations, and practically allowing more cases for non-unique indexes. > See, I think I understand why partial/expression indexes can't be supported. It seems to me that because the required tuple may not satisfy the expression and that won't work for our case. But what are other limitations you see due to which we can't support other index types for non-unique indexes? Is it just a matter of testing other index types or there is something more to it, if so, we should add comments so that they can be supported in the future if it is feasible to do so. > > Attached are both patches: the main patch, and the patch that > optionally disables the index scans. > Both the patches are numbered 0001. It would be better to number them as 0001 and 0002. --=20 With Regards, Amit Kapila.