Re: Hash table scans outside transactions

2025-05-25 Thread Aidar Imamov
Aidar Imamov wrote 2025-05-21 00:32: Ashutosh Bapat wrote 2023-03-28 15:58: Bumping it to attract some attention. On Tue, Mar 21, 2023 at 12:51 PM Ashutosh Bapat wrote: Hi, Hash table scans (seq_scan_table/level) are cleaned up at the end of a transaction in AtEOXact_HashTables(). If a

Re: Hash table scans outside transactions

2025-05-20 Thread Aidar Imamov
ounter if we find scans that started outside of the current transaction at the end. I have to admit, though, that I can't immediately say what other implications this might have or what else we need to watch out for if we try this. Maybe any thoughts on that? regards, Aidar Imamov diff --git a/c

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-04-05 Thread Aidar Imamov
object or marks them as dirty... I can't really say for sure about that. And in that context, I'd suggest referring to that awesome statement in the documentation: "If in doubt, functions should be labeled as UNSAFE, which is the default." regards, Aidar Imamov

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-04-05 Thread Aidar Imamov
k. In addition, this would remove the "flushed" parameter from the EvictUnpinnedBuffer() function. Because if we explicitly call LockBufHdr() outside of EvictUnpinnedBuffer(), we can already know in advance whether the buffer is dirty or not. The same applies to the suggestion to retrieve "flushed" count from the pg_buffercache_evict() call. We cannot say this for certain, but we can determine whether the buffer was dirty. regards, Aidar Imamov

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-03-27 Thread Aidar Imamov
dit the elog text to: "bad shared buffer ID" - just to clarify the case when provided buffer number is negative (local buffer number). pg_buffercache_mark_dirty_all(): Maybe also edit the comment to: "Try to mark all the shared buffers as dirty."? bufmgr.h: I think it might be a good idea to follow the Postgres formatting style and move the function's arguments to the next line if they exceed 80 characters. regards, Aidar Imamov

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-03-18 Thread Aidar Imamov
r of the BufTagMatchesRelFileLocator() and LockBufHdr() calls for improved efficiency (as mentioned in the comment on the BufTagMatchesRelFileLocator() call in the DropRelationBuffers() function in bufmgr.c). And it maybe useful also to add BUT_STATE_GET_REFCOUNT == 0 precheck before calling EvictUnpinnedBuffer()? regards, Aidar Imamov