From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
---|---|
To: | 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Cc: | "ShlokKumar(dot)Kyal(at)fujitsu(dot)com" <ShlokKumar(dot)Kyal(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
Subject: | RE: Selectively invalidate caches in pgoutput module |
Date: | 2025-03-06 11:45:56 |
Message-ID: | OSCPR01MB1496638A193D30795EC24386FF5CA2@OSCPR01MB14966.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear Amit, hackers,
> Yeah, this is a good improvement and the patch looks safe to me, so I
> pushed with minor changes in the comments.
Thanks! PSA rebased patch. While considering more about 0002, I found a
conceptual bug - when relsync cache could not be re-built when SQL interfaces are
used. In old vesrion inval messages were not recorded on the WAL, so relsync
cache could not be discarded if decoding happed later.
In new version, the invalidation is handled as transactional and serialized to
the WAL. More detail, messages are stored in InvalMessageArrays and consumed at
the end of transactions. For simplfication, the subgroup of the message is set
as "relcache" when serializing. But IIUC the handling is OK - snapshot
invalidation does the same approach.
I did a performance testing with given patch. ()
Mostly same as previous test but used two publications.
1. Initialize an instance
2. Create a root table and leaf tables. The variable $NUM_PART controls
how many partitions exist on the instance.
3. Create another table
4. Create publications (p1, p2). One includes a root table, and another one includes
independent table.
5. Create a replication slot with pgoutput plugint.
6. Execute a transaction which would be decoded. In the transaction:
a. Insert tuples to all the leaf tables
b. Rename publication p2 to p2_renamed
c. Rename publication p2_renamed to p2
d. Insert tuples to all the leaf tables again.
7. decode all the changes via SQL interfaces.
My expectation is for HEAD, leaves are cached at a), but they would be
discarded at b) and c), then they are cached again at d).
For patched case, it only an independent table would be discarded at b) and c) so the
decoding time should be reduced.
Below results are the median of five runs. ITSM around 15% improvements.
head [ms] patched (0001-0003)
239 200
> Ideally, we need the time of only step-6d with and without the patch.
> Step 6-a is required to build the cache, but in actual workloads via
> walsender, we won't need that, and also, at the end of SQL API
> execution, we will forcibly invalidate all caches, so that is also not
> required. See, if in the performance measurement of the next set of
> patches, you can avoid that.
Hmm. It requires additional debug messages. Let me consider.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
Attachment | Content-Type | Size |
---|---|---|
v4-0001-Introduce-a-new-invalidation-message-to-invalidat.patch | application/octet-stream | 8.8 KB |
v4-0002-Invalidate-Relcaches-while-ALTER-PUBLICATION-OWNE.patch | application/octet-stream | 7.8 KB |
test_r.sh | application/octet-stream | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kirill Reshke | 2025-03-06 12:02:52 | Re: ZStandard (with dictionaries) compression support for TOAST compression |
Previous Message | John Naylor | 2025-03-06 11:45:40 | Re: Improve CRC32C performance on SSE4.2 |