Attached is a patch which should marginally improve the ctid chain followin code path when current and the next tuple in the chain are in the same block.
In the current code, we unconditionally drop pin of the current block without checking whether the next tuple is the same block or not. ISTM that this can be improved. The attached patch replaces the heap_fetch() with heap_release_fetch() in EvalPlanQual() and thus releases the buffer iff the chain gets into a different block. Similarly, ReadBuffer() is replaced with ReleaseAndReadBuffer() in heap_get_latest_tid() for the same reason. The buffer is set to InvalidBuffer to start with and is not released at the end of the loop. heap_release_fetch()/ ReleaseAndReadBuffer() would release it if required. Thanks, Pavan -- EnterpriseDB http://www.enterprisedb.com
cf-enhance-head.patch
Description: Binary data
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
