mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Arrange for large sequential scans to synchronize with each other, so that
when multiple backends are scanning the same relation concurrently, each page is (ideally) read only once. Jeff Davis, with review by Heikki and Tom.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.124 2007/05/27 03:50:39 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.125 2007/06/08 18:23:53 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -112,6 +112,13 @@ extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
|
||||
)
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LockTupleShared,
|
||||
LockTupleExclusive
|
||||
} LockTupleMode;
|
||||
|
||||
|
||||
/* ----------------
|
||||
* function prototypes for heap access method
|
||||
*
|
||||
@@ -120,14 +127,7 @@ extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* heapam.c */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LockTupleShared,
|
||||
LockTupleExclusive
|
||||
} LockTupleMode;
|
||||
|
||||
/* in heap/heapam.c */
|
||||
extern Relation relation_open(Oid relationId, LOCKMODE lockmode);
|
||||
extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode);
|
||||
extern Relation relation_open_nowait(Oid relationId, LOCKMODE lockmode);
|
||||
@@ -240,4 +240,10 @@ extern HeapTuple heap_addheader(int natts, bool withoid,
|
||||
|
||||
extern void heap_sync(Relation relation);
|
||||
|
||||
/* in heap/syncscan.c */
|
||||
extern void ss_report_location(Relation rel, BlockNumber location);
|
||||
extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
|
||||
extern void SyncScanShmemInit(void);
|
||||
extern Size SyncScanShmemSize(void);
|
||||
|
||||
#endif /* HEAPAM_H */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.54 2007/05/30 20:12:02 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.55 2007/06/08 18:23:53 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -26,9 +26,13 @@ typedef struct HeapScanDescData
|
||||
Snapshot rs_snapshot; /* snapshot to see */
|
||||
int rs_nkeys; /* number of scan keys */
|
||||
ScanKey rs_key; /* array of scan key descriptors */
|
||||
|
||||
/* state set up at initscan time */
|
||||
BlockNumber rs_nblocks; /* number of blocks to scan */
|
||||
BlockNumber rs_startblock; /* block # to start at */
|
||||
BufferAccessStrategy rs_strategy; /* access strategy for reads */
|
||||
bool rs_pageatatime; /* verify visibility page-at-a-time? */
|
||||
bool rs_syncscan; /* report location to syncscan logic? */
|
||||
|
||||
/* scan current state */
|
||||
bool rs_inited; /* false = scan not init'd yet */
|
||||
|
||||
Reference in New Issue
Block a user