From: Pavan Deolasee Date: Mon, 11 Jul 2016 07:07:11 +0000 (+0530) Subject: No need to look at the relation size everytime rescanning a relation with X-Git-Tag: XL9_5_R1_2~29 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=e34b6ba45009e2e9c5c631b1464cec04d3834733;p=postgres-xl.git No need to look at the relation size everytime rescanning a relation with sequence scan This can provide big boost to performance when the inner side of a nested loop has a sequence scan with large number of rows in outer relation --- diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 06a2b1a039..90bc0d78f0 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -229,7 +229,8 @@ initscan(HeapScanDesc scan, ScanKey key, bool keep_startblock) * results for a non-MVCC snapshot, the caller must hold some higher-level * lock that ensures the interesting tuple(s) won't change.) */ - scan->rs_nblocks = RelationGetNumberOfBlocks(scan->rs_rd); + if (!keep_startblock) + scan->rs_nblocks = RelationGetNumberOfBlocks(scan->rs_rd); /* * If the table is large relative to NBuffers, use a bulk-read access