Re: How to accurately determine when a relation should use local buffers?

2023-11-27 Thread Давыдов Виталий
Hi Aleksander, Well even assuming this patch will make it to the upstream some day, which I seriously doubt, it will take somewhere between 2 and 5 years. Personally I would recommend reconsidering this design. I understand what you are saying. I have no plans to create a patch for this issue. I

Re: How to accurately determine when a relation should use local buffers?

2023-11-24 Thread Aleksander Alekseev
Hi, > There are some changes in ReadBuffer logic if to compare with pg15. To define > which buffers to use, ReadBuffer used SmgrIsTemp function in pg15. The > decision was based on backend id of the relation. In pg16 the decision is > based on relpersistence attribute, that caused some

Re: How to accurately determine when a relation should use local buffers?

2023-11-23 Thread Давыдов Виталий
Hi Aleksander, I sort of suspect that you are working on a very specific extension and/or feature for PG fork. Any chance you could give us more details about the case?I'm trying to adapt a multimaster solution to some changes in pg16. We replicate temp table DDL due to some reasons.

Re: How to accurately determine when a relation should use local buffers?

2023-11-22 Thread Aleksander Alekseev
Hi, > I would propose not to associate temporary relations with local buffers The whole point of why local buffers exist is to place the buffers of temp tables into MemoryContexts so that these tables will not fight for the locks for shared buffers with the rest of the system. If we start

Re: How to accurately determine when a relation should use local buffers?

2023-11-22 Thread Давыдов Виталий
Hi Aleksander, Thank you for your answers. It seems, local buffers are used for temporary relations unconditionally. In this case, we may check either relpersistence or backend id, or both of them. I didn't do a deep investigation of the code in this particular aspect but that could be a fair

Re: How to accurately determine when a relation should use local buffers?

2023-11-21 Thread Aleksander Alekseev
Hi, > Furthermore, there is some possible inconsistency in the code show below > (REL_16_STABLE) in bufmgr.c file: > > FlushRelationBuffers, PrefetchBuffer uses RelationUsesLocalBuffers(rel). > ExtendBufferedRel_common finally use BufferManagerRelation.relpersistence > which is actually

Re: How to accurately determine when a relation should use local buffers?

2023-11-21 Thread Vitaly Davydov
Hi Aleksander, Thank you for the reply. > Could you please provide a specific example when the current code willdo > something wrong/unintended? I can't say that something is wrong in vanilla. But if you decide to replicate DDL in some solutions like multimaster, you might want to replicate

Re: How to accurately determine when a relation should use local buffers?

2023-11-21 Thread Aleksander Alekseev
Hi, > I would like to clarify, what the correct way is to determine that a given > relation is using local buffers. Local buffers, as far as I know, are used > for temporary tables in backends. There are two functions/macros (bufmgr.c): > SmgrIsTemp, RelationUsesLocalBuffers. The first

How to accurately determine when a relation should use local buffers?

2023-11-20 Thread Давыдов Виталий
Dear Hackers, I would like to clarify, what the correct way is to determine that a given relation is using local buffers. Local buffers, as far as I know, are used for temporary tables in backends. There are two functions/macros (bufmgr.c): SmgrIsTemp, RelationUsesLocalBuffers. The first