RE: Force streaming every change in logical decoding
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Amit Kapila' <amit.kapila16@gmail.com>
Cc: "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>, Sawada Masahiko <sawada.mshk@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-12-21T05:55:41Z
Lists: pgsql-hackers
Dear Amit, > The other possibility to achieve what you are saying is that we allow > a minimum value of logical_decoding_work_mem as 0 which would mean > stream or serialize each change depending on whether the streaming > option is enabled. I understood that logical_decoding_work_mem may double as normal option as developer option. I think yours is smarter because we can reduce # of GUCs. > I think we normally don't allow a minimum value > below a certain threshold for other *_work_mem parameters (like > maintenance_work_mem, work_mem), so we have followed the same here. > And, I think it makes sense from the user's perspective because below > a certain threshold it will just add overhead by either writing small > changes to the disk or by sending those over the network. However, it > can be quite useful for testing/debugging. So, not sure, if we should > restrict setting logical_decoding_work_mem below a certain threshold. > What do you think? You mean to say that there is a possibility that users may set a small value without deep considerations, right? If so, how about using the approach like autovacuum_work_mem? autovacuum_work_mem has a range [-1, MAX_KIROBYTES], and -1 mean that it follows maintenance_work_mem. If it is set small value like 5KB, its working memory is rounded up to 1024KB. See check_autovacuum_work_mem(). Based on that, I suggest followings. Can they solve the problem what you said? * If logical_decoding_work_mem is set to 0, all transactions are streamed or serialized on publisher. * If logical_decoding_work_mem is set within [1, 63KB], the value is rounded up or ERROR is raised. * If logical_decoding_work_mem is set greater than or equal to 64KB, the set value is used. Best Regards, Hayato Kuroda FUJITSU LIMITED > Amit Kapila.
Commits
-
Add 'logical_decoding_mode' GUC.
- 5de94a041ed7 16.0 landed
-
Clean up some inconsistencies with GUC declarations
- d9d873bac670 16.0 cited