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 1pVros-0003Pl-2B for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Feb 2023 10:30:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pVroq-0007n1-HY for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Feb 2023 10:30:20 +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 1pVroq-0007ms-7y for pgsql-hackers@lists.postgresql.org; Sat, 25 Feb 2023 10:30:20 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pVron-0004YD-RM for pgsql-hackers@lists.postgresql.org; Sat, 25 Feb 2023 10:30:19 +0000 Received: by mail-oi1-x229.google.com with SMTP id y184so1449601oiy.8 for ; Sat, 25 Feb 2023 02:30:17 -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=s4zN/XMfj73oTMV5FkYAs7F8AhxtRxjH+iF99Zqo2OU=; b=KQHpDGVYTPDDNtREBDlYfYkyZFiz5WK7cnd+EMbbaGuSIyGN3ljB04WbirTttW6DJF TIXadgRaqN1w5treXBpDJ1SLq8IsQMEmHzGZs7nkb7+eo+kxgDnY892P37Nkr2c/Pb5J IQVhT3JOMXhGSgvhz75tT7SxK7OFFHWVt9U6gWlfUGKYa7Ge/dJ7oUuBj+QEnUFnmO2F dpg+/6Q+wshZ7OH5oe0i9y4/YXyC+Lrv9mC4w/86Y91UFYQBMOnlcGD+ovvFLO2+Mm9c 3HnlglvVVAYEGCoAkYDuJs92nvlHj3xvHuVB3q1DGLL1Y2k/gTBONvNkGZrkmeah2dFr STSw== 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=s4zN/XMfj73oTMV5FkYAs7F8AhxtRxjH+iF99Zqo2OU=; b=HCvIH0UC2RBGtVjonLcjxjFKXHp6w5jv1zo1PM2VzQV6Wtrpy1HGfa4Rf1Qmq+WxJy cbhcdjzPtKoLyYMVWtZQ6hG66CKPmbUN3htNiHvU3hNKxyZHUK+wsA+lvb8WRE96SpCD sxwNMDOjSWpBVk2smdZ3+63lVFsdu3/aA+afzl0m1LaZm7w2tYnGLZ++X085jn1zF29L w9aVNEHf9vP8DnhxI431DcthdyQwSI2Ex9kCcVsXvQPk6FOBc9Wdb+VCCG1Zko01o/Vd sWNzCywQHaMcq1jgKT08oPZrSQYEdD3R90y7fEFdNrlqidewyiKMY1j4q1yPVAb/zjUD luJA== X-Gm-Message-State: AO0yUKVJ4aRtE7KdDkwyd/h0zacJ7+W8BQz8UsHnPk+GiI0GPbneNAHw Hye/OPB1Oszmd1jS+HlJKZf+JiQyCnU4In6TG0T1ycPubAc= X-Google-Smtp-Source: AK7set+to6JMNl9MuApcqfgbRenAq5P0nKd3XoXtKpFP3qOJDNcUhuzPlsA0TEnuSstqfUBkrk8W/q7hwz0AUTNCVLA= X-Received: by 2002:a05:6808:89:b0:384:bd7:c92b with SMTP id s9-20020a056808008900b003840bd7c92bmr893463oic.10.1677321016996; Sat, 25 Feb 2023 02:30:16 -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: Sat, 25 Feb 2023 16:00:05 +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" , Marco Slot , Tom Lane , Andres Freund , "wangw.fnst@fujitsu.com" , 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 Tue, Feb 21, 2023 at 7:55 PM =C3=96nder Kalac=C4=B1 wrote: > >> >> I think this overhead seems to be mostly due to the need to perform >> tuples_equal multiple times for duplicate values. I don't know if >> there is any simple way to avoid this without using the planner stuff >> as was used in the previous approach. So, this brings us to the >> question of whether just providing a way to disable/enable the use of >> index scan for such cases is sufficient or if we need any other way. >> >> Tom, Andres, or others, do you have any suggestions on how to move >> forward with this patch? >> > > Thanks for the feedback and testing. Due to personal circumstances, > I could not reply the thread in the last 2 weeks, but I'll be more active > going forward. > > I also agree that we should have a way to control the behavior. > > I created another patch (v24_0001_optionally_disable_index.patch) which c= an be applied > on top of v23_0001_use_index_on_subs_when_pub_rep_ident_full.patch. > > The new patch adds a new subscription_parameter for both CREATE and ALTER= subscription > named: enable_index_scan. The setting is valid only when REPLICA IDENTITY= is full. > > What do you think about such a patch to control the behavior? It does not= give a per-relation > level of control, but still useful for many cases. > Wouldn't a table-level option like 'apply_index_scan' be better than a subscription-level option with a default value as false? Anyway, the bigger point is that we don't see a better way to proceed here than to introduce some option to control this behavior. I see this as a way to provide this feature for users but I would prefer to proceed with this if we can get some more buy-in from senior community members (at least one more committer) and some user(s) if possible. So, I once again request others to chime in and share their opinion. --=20 With Regards, Amit Kapila.