RE: [PATCH] Improving index selection for logical replication apply with replica identity full

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Bharath Rupireddy' <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Ethan Mertz <ethan(dot)mertz(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "onderkalaci(at)gmail(dot)com" <onderkalaci(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Subject: RE: [PATCH] Improving index selection for logical replication apply with replica identity full
Date: 2026-06-22 10:05:36
Message-ID: TYRPR01MB12156CDC14DB15747719D38F9F5EF2@TYRPR01MB12156.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Bharath, Ethan,

> Do we know the cost of invoking the planner for index selection on the
> subscriber? AFAICS, the selection happens on the first apply or
> whenever the relcache entry gets invalidated - so it's infrequent [1].
> If that's the case, why not invoke the planner to make a
> better-informed decision? It would account for bloat, size,
> selectivity etc. I think it would be worth measuring the performance
> impact before proceeding with the just unique vs. non-unique approach.

Personally I'm still cautious to call planner code because of the maintenance cost.
I'm not sure it's helpful to extend codes only for the REPLICA IDENTITY FULL case.
But I see your point a bit, no one may not have compared these execution costs.

Regarding the code, it looked basically good, but one concern is that the
selection could be slightly worse if several indexes are defined; it needs to
iterate all the index entries in any cases. Can you prove the performance is
acceptable?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2026-06-22 10:13:39 Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values
Previous Message Chao Li 2026-06-22 09:34:53 psql: Fix CREATE SCHEMA scanning of nested routine bodies