Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
2bb1f14b
Commit
2bb1f14b
authored
Jan 13, 2014
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make bitmap heap scans show exact/lossy block info in EXPLAIN ANALYZE.
Etsuro Fujita
parent
c3ccc9ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
1 deletion
+43
-1
src/backend/commands/explain.c
src/backend/commands/explain.c
+32
-1
src/backend/executor/nodeBitmapHeapscan.c
src/backend/executor/nodeBitmapHeapscan.c
+7
-0
src/include/nodes/execnodes.h
src/include/nodes/execnodes.h
+4
-0
No files found.
src/backend/commands/explain.c
View file @
2bb1f14b
...
...
@@ -85,6 +85,8 @@ static void show_sort_group_keys(PlanState *planstate, const char *qlabel,
List
*
ancestors
,
ExplainState
*
es
);
static
void
show_sort_info
(
SortState
*
sortstate
,
ExplainState
*
es
);
static
void
show_hash_info
(
HashState
*
hashstate
,
ExplainState
*
es
);
static
void
show_tidbitmap_info
(
BitmapHeapScanState
*
planstate
,
ExplainState
*
es
);
static
void
show_instrumentation_count
(
const
char
*
qlabel
,
int
which
,
PlanState
*
planstate
,
ExplainState
*
es
);
static
void
show_foreignscan_info
(
ForeignScanState
*
fsstate
,
ExplainState
*
es
);
...
...
@@ -1250,7 +1252,13 @@ ExplainNode(PlanState *planstate, List *ancestors,
if
(((
BitmapHeapScan
*
)
plan
)
->
bitmapqualorig
)
show_instrumentation_count
(
"Rows Removed by Index Recheck"
,
2
,
planstate
,
es
);
/* FALL THRU */
show_scan_qual
(
plan
->
qual
,
"Filter"
,
planstate
,
ancestors
,
es
);
if
(
plan
->
qual
)
show_instrumentation_count
(
"Rows Removed by Filter"
,
1
,
planstate
,
es
);
if
(
es
->
analyze
)
show_tidbitmap_info
((
BitmapHeapScanState
*
)
planstate
,
es
);
break
;
case
T_SeqScan
:
case
T_ValuesScan
:
case
T_CteScan
:
...
...
@@ -1878,6 +1886,29 @@ show_hash_info(HashState *hashstate, ExplainState *es)
}
}
/*
* If it's EXPLAIN ANALYZE, show exact/lossy pages for a BitmapHeapScan node
*/
static
void
show_tidbitmap_info
(
BitmapHeapScanState
*
planstate
,
ExplainState
*
es
)
{
if
(
es
->
format
!=
EXPLAIN_FORMAT_TEXT
)
{
ExplainPropertyLong
(
"Exact Heap Blocks"
,
planstate
->
exact_pages
,
es
);
ExplainPropertyLong
(
"Lossy Heap Blocks"
,
planstate
->
lossy_pages
,
es
);
}
else
{
appendStringInfoSpaces
(
es
->
str
,
es
->
indent
*
2
);
appendStringInfoString
(
es
->
str
,
"Heap Blocks:"
);
if
(
planstate
->
exact_pages
>
0
)
appendStringInfo
(
es
->
str
,
" exact=%ld"
,
planstate
->
exact_pages
);
if
(
planstate
->
lossy_pages
>
0
)
appendStringInfo
(
es
->
str
,
" lossy=%ld"
,
planstate
->
lossy_pages
);
appendStringInfoChar
(
es
->
str
,
'\n'
);
}
}
/*
* If it's EXPLAIN ANALYZE, show instrumentation information for a plan node
*
...
...
src/backend/executor/nodeBitmapHeapscan.c
View file @
2bb1f14b
...
...
@@ -170,6 +170,11 @@ BitmapHeapNext(BitmapHeapScanState *node)
*/
bitgetpage
(
scan
,
tbmres
);
if
(
tbmres
->
ntuples
>=
0
)
node
->
exact_pages
++
;
else
node
->
lossy_pages
++
;
/*
* Set rs_cindex to first slot to examine
*/
...
...
@@ -553,6 +558,8 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
scanstate
->
tbm
=
NULL
;
scanstate
->
tbmiterator
=
NULL
;
scanstate
->
tbmres
=
NULL
;
scanstate
->
exact_pages
=
0
;
scanstate
->
lossy_pages
=
0
;
scanstate
->
prefetch_iterator
=
NULL
;
scanstate
->
prefetch_pages
=
0
;
scanstate
->
prefetch_target
=
0
;
...
...
src/include/nodes/execnodes.h
View file @
2bb1f14b
...
...
@@ -1338,6 +1338,8 @@ typedef struct BitmapIndexScanState
* tbm bitmap obtained from child index scan(s)
* tbmiterator iterator for scanning current pages
* tbmres current-page data
* exact_pages total number of exact pages retrieved
* lossy_pages total number of lossy pages retrieved
* prefetch_iterator iterator for prefetching ahead of current page
* prefetch_pages # pages prefetch iterator is ahead of current
* prefetch_target target prefetch distance
...
...
@@ -1350,6 +1352,8 @@ typedef struct BitmapHeapScanState
TIDBitmap
*
tbm
;
TBMIterator
*
tbmiterator
;
TBMIterateResult
*
tbmres
;
long
exact_pages
;
long
lossy_pages
;
TBMIterator
*
prefetch_iterator
;
int
prefetch_pages
;
int
prefetch_target
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment