diff options
Diffstat (limited to 'src/include/access/genam.h')
-rw-r--r-- | src/include/access/genam.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 1be8739573f..5b2ab181b5f 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -27,6 +27,27 @@ struct IndexInfo; /* + * Struct for statistics maintained by amgettuple and amgetbitmap + * + * Note: IndexScanInstrumentation can't contain any pointers, since it is + * copied into a SharedIndexScanInstrumentation during parallel scans + */ +typedef struct IndexScanInstrumentation +{ + /* Index search count (incremented with pgstat_count_index_scan call) */ + uint64 nsearches; +} IndexScanInstrumentation; + +/* + * Struct for every worker's IndexScanInstrumentation, stored in shared memory + */ +typedef struct SharedIndexScanInstrumentation +{ + int num_workers; + IndexScanInstrumentation winstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedIndexScanInstrumentation; + +/* * Struct for statistics returned by ambuild */ typedef struct IndexBuildResult @@ -157,9 +178,11 @@ extern void index_insert_cleanup(Relation indexRelation, extern IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot, + IndexScanInstrumentation *instrument, int nkeys, int norderbys); extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation, Snapshot snapshot, + IndexScanInstrumentation *instrument, int nkeys); extern void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, @@ -168,13 +191,20 @@ extern void index_endscan(IndexScanDesc scan); extern void index_markpos(IndexScanDesc scan); extern void index_restrpos(IndexScanDesc scan); extern Size index_parallelscan_estimate(Relation indexRelation, - int nkeys, int norderbys, Snapshot snapshot); + int nkeys, int norderbys, Snapshot snapshot, + bool instrument, bool parallel_aware, + int nworkers); extern void index_parallelscan_initialize(Relation heapRelation, Relation indexRelation, Snapshot snapshot, + bool instrument, bool parallel_aware, + int nworkers, + SharedIndexScanInstrumentation **sharedinfo, ParallelIndexScanDesc target); extern void index_parallelrescan(IndexScanDesc scan); extern IndexScanDesc index_beginscan_parallel(Relation heaprel, - Relation indexrel, int nkeys, int norderbys, + Relation indexrel, + IndexScanInstrumentation *instrument, + int nkeys, int norderbys, ParallelIndexScanDesc pscan); extern ItemPointer index_getnext_tid(IndexScanDesc scan, ScanDirection direction); |