mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 10:30:33 +03:00 
			
		
		
		
	Add a column pg_class.relallvisible to remember the number of pages that were all-visible according to the visibility map as of the last VACUUM (or ANALYZE, or some other operations that update pg_class.relpages). Use relallvisible/relpages, instead of an arbitrary constant, to estimate how many heap page fetches can be avoided during an index-only scan. This is pretty primitive and will no doubt see refinements once we've acquired more field experience with the index-only scan mechanism, but it's way better than using a constant. Note: I had to adjust an underspecified query in the window.sql regression test, because it was changing answers when the plan changed to use an index-only scan. Some of the adjacent tests perhaps should be adjusted as well, but I didn't do that here.
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*-------------------------------------------------------------------------
 | |
|  *
 | |
|  * visibilitymap.h
 | |
|  *		visibility map interface
 | |
|  *
 | |
|  *
 | |
|  * Portions Copyright (c) 2007-2011, PostgreSQL Global Development Group
 | |
|  * Portions Copyright (c) 1994, Regents of the University of California
 | |
|  *
 | |
|  * src/include/access/visibilitymap.h
 | |
|  *
 | |
|  *-------------------------------------------------------------------------
 | |
|  */
 | |
| #ifndef VISIBILITYMAP_H
 | |
| #define VISIBILITYMAP_H
 | |
| 
 | |
| #include "access/xlogdefs.h"
 | |
| #include "storage/block.h"
 | |
| #include "storage/buf.h"
 | |
| #include "utils/relcache.h"
 | |
| 
 | |
| extern void visibilitymap_clear(Relation rel, BlockNumber heapBlk,
 | |
| 					Buffer vmbuf);
 | |
| extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk,
 | |
| 				  Buffer *vmbuf);
 | |
| extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf);
 | |
| extern void visibilitymap_set(Relation rel, BlockNumber heapBlk,
 | |
| 				  XLogRecPtr recptr, Buffer vmbuf);
 | |
| extern bool visibilitymap_test(Relation rel, BlockNumber heapBlk, Buffer *vmbuf);
 | |
| extern BlockNumber visibilitymap_count(Relation rel);
 | |
| extern void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks);
 | |
| 
 | |
| #endif   /* VISIBILITYMAP_H */
 |