1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

Revert "Show index search count in EXPLAIN ANALYZE."

This reverts commit 5ead85fbc8.

This commit shows test failures with debug_parallel_query=regress.  The
underlying issue needs to be debugged, so revert for now.
This commit is contained in:
Peter Geoghegan
2025-03-05 10:27:31 -05:00
parent 4603903d29
commit d00107cd63
22 changed files with 49 additions and 310 deletions

View File

@@ -591,7 +591,6 @@ bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
opaque = (BrinOpaque *) scan->opaque;
bdesc = opaque->bo_bdesc;
pgstat_count_index_scan(idxRel);
scan->nsearches++;
/*
* We need to know the size of the table so that we know how long to

View File

@@ -437,7 +437,6 @@ ginNewScanKey(IndexScanDesc scan)
MemoryContextSwitchTo(oldCtx);
pgstat_count_index_scan(scan->indexRelation);
scan->nsearches++;
}
void

View File

@@ -625,7 +625,6 @@ gistgettuple(IndexScanDesc scan, ScanDirection dir)
GISTSearchItem fakeItem;
pgstat_count_index_scan(scan->indexRelation);
scan->nsearches++;
so->firstCall = false;
so->curPageData = so->nPageData = 0;
@@ -751,7 +750,6 @@ gistgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
return 0;
pgstat_count_index_scan(scan->indexRelation);
scan->nsearches++;
/* Begin the scan by processing the root page */
so->curPageData = so->nPageData = 0;

View File

@@ -298,7 +298,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
HashScanPosItem *currItem;
pgstat_count_index_scan(rel);
scan->nsearches++;
/*
* We do not support hash scans with no index qualification, because we

View File

@@ -119,7 +119,6 @@ RelationGetIndexScan(Relation indexRelation, int nkeys, int norderbys)
scan->ignore_killed_tuples = !scan->xactStartedInRecovery;
scan->opaque = NULL;
scan->nsearches = 0;
scan->xs_itup = NULL;
scan->xs_itupdesc = NULL;

View File

@@ -70,7 +70,6 @@ typedef struct BTParallelScanDescData
BTPS_State btps_pageStatus; /* indicates whether next page is
* available for scan. see above for
* possible states of parallel scan. */
uint64 btps_nsearches; /* tracked for IndexScanDescData.nsearches */
slock_t btps_mutex; /* protects above variables, btps_arrElems */
ConditionVariable btps_cv; /* used to synchronize parallel scan */
@@ -558,7 +557,6 @@ btinitparallelscan(void *target)
bt_target->btps_nextScanPage = InvalidBlockNumber;
bt_target->btps_lastCurrPage = InvalidBlockNumber;
bt_target->btps_pageStatus = BTPARALLEL_NOT_INITIALIZED;
bt_target->btps_nsearches = 0;
ConditionVariableInit(&bt_target->btps_cv);
}
@@ -585,7 +583,6 @@ btparallelrescan(IndexScanDesc scan)
btscan->btps_nextScanPage = InvalidBlockNumber;
btscan->btps_lastCurrPage = InvalidBlockNumber;
btscan->btps_pageStatus = BTPARALLEL_NOT_INITIALIZED;
/* deliberately don't reset btps_nsearches (matches index_rescan) */
SpinLockRelease(&btscan->btps_mutex);
}
@@ -679,7 +676,6 @@ _bt_parallel_seize(IndexScanDesc scan, BlockNumber *next_scan_page,
{
/* Can start scheduled primitive scan right away, so do so */
btscan->btps_pageStatus = BTPARALLEL_ADVANCING;
btscan->btps_nsearches++;
for (int i = 0; i < so->numArrayKeys; i++)
{
BTArrayKeyInfo *array = &so->arrayKeys[i];
@@ -716,11 +712,6 @@ _bt_parallel_seize(IndexScanDesc scan, BlockNumber *next_scan_page,
*/
btscan->btps_pageStatus = BTPARALLEL_ADVANCING;
Assert(btscan->btps_nextScanPage != P_NONE);
if (btscan->btps_nextScanPage == InvalidBlockNumber)
{
Assert(first);
btscan->btps_nsearches++;
}
*next_scan_page = btscan->btps_nextScanPage;
*last_curr_page = btscan->btps_lastCurrPage;
exit_loop = true;
@@ -819,12 +810,6 @@ _bt_parallel_done(IndexScanDesc scan)
btscan->btps_pageStatus = BTPARALLEL_DONE;
status_changed = true;
}
/*
* Don't use local nsearches counter -- overwrite it with the nsearches
* counter that we've been maintaining in shared memory
*/
scan->nsearches = btscan->btps_nsearches;
SpinLockRelease(&btscan->btps_mutex);
/* wake up all the workers associated with this parallel scan */

View File

@@ -950,7 +950,6 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* _bt_search/_bt_endpoint below
*/
pgstat_count_index_scan(rel);
scan->nsearches++;
/*----------
* Examine the scan keys to discover where we need to start the scan.

View File

@@ -421,7 +421,6 @@ spgrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
/* count an indexscan for stats */
pgstat_count_index_scan(scan->indexRelation);
scan->nsearches++;
}
void

View File

@@ -13,7 +13,6 @@
*/
#include "postgres.h"
#include "access/relscan.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "commands/createas.h"
@@ -126,7 +125,6 @@ static void show_recursive_union_info(RecursiveUnionState *rstate,
static void show_memoize_info(MemoizeState *mstate, List *ancestors,
ExplainState *es);
static void show_hashagg_info(AggState *aggstate, ExplainState *es);
static void show_indexsearches_info(PlanState *planstate, ExplainState *es);
static void show_tidbitmap_info(BitmapHeapScanState *planstate,
ExplainState *es);
static void show_instrumentation_count(const char *qlabel, int which,
@@ -2098,7 +2096,6 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (plan->qual)
show_instrumentation_count("Rows Removed by Filter", 1,
planstate, es);
show_indexsearches_info(planstate, es);
break;
case T_IndexOnlyScan:
show_scan_qual(((IndexOnlyScan *) plan)->indexqual,
@@ -2115,12 +2112,10 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (es->analyze)
ExplainPropertyFloat("Heap Fetches", NULL,
planstate->instrument->ntuples2, 0, es);
show_indexsearches_info(planstate, es);
break;
case T_BitmapIndexScan:
show_scan_qual(((BitmapIndexScan *) plan)->indexqualorig,
"Index Cond", planstate, ancestors, es);
show_indexsearches_info(planstate, es);
break;
case T_BitmapHeapScan:
show_scan_qual(((BitmapHeapScan *) plan)->bitmapqualorig,
@@ -3860,41 +3855,6 @@ show_hashagg_info(AggState *aggstate, ExplainState *es)
}
}
/*
* Show the total number of index searches performed by a
* IndexScan/IndexOnlyScan/BitmapIndexScan node
*/
static void
show_indexsearches_info(PlanState *planstate, ExplainState *es)
{
Plan *plan = planstate->plan;
struct IndexScanDescData *scanDesc = NULL;
uint64 nsearches = 0;
if (!es->analyze)
return;
switch (nodeTag(plan))
{
case T_IndexScan:
scanDesc = ((IndexScanState *) planstate)->iss_ScanDesc;
break;
case T_IndexOnlyScan:
scanDesc = ((IndexOnlyScanState *) planstate)->ioss_ScanDesc;
break;
case T_BitmapIndexScan:
scanDesc = ((BitmapIndexScanState *) planstate)->biss_ScanDesc;
break;
default:
break;
}
if (scanDesc)
nsearches = scanDesc->nsearches;
ExplainPropertyUInteger("Index Searches", NULL, nsearches, es);
}
/*
* Show exact/lossy pages for a BitmapHeapScan node
*/