Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b05185

Browse files
committed
Remove support for OR'd indexscans internal to a single IndexScan plan
node, as this behavior is now better done as a bitmap OR indexscan.This allows considerable simplification in nodeIndexscan.c itself aswell as several planner modules concerned with indexscan plan generation.Also we can improve the sharing of code between regular and bitmapindexscans, since they are now working with nigh-identical Plan nodes.
1 parent186655e commit5b05185

File tree

21 files changed

+714
-1927
lines changed

21 files changed

+714
-1927
lines changed

‎src/backend/commands/explain.c

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994-5, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.134 2005/04/22 21:58:31 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.135 2005/04/25 01:30:12 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -52,7 +52,7 @@ static void explain_outNode(StringInfo str,
5252
Plan*plan,PlanState*planstate,
5353
Plan*outer_plan,
5454
intindent,ExplainState*es);
55-
staticvoidshow_scan_qual(List*qual,boolis_or_qual,constchar*qlabel,
55+
staticvoidshow_scan_qual(List*qual,constchar*qlabel,
5656
intscanrelid,Plan*outer_plan,
5757
StringInfostr,intindent,ExplainState*es);
5858
staticvoidshow_upper_qual(List*qual,constchar*qlabel,
@@ -62,7 +62,6 @@ static void show_upper_qual(List *qual, const char *qlabel,
6262
staticvoidshow_sort_keys(List*tlist,intnkeys,AttrNumber*keycols,
6363
constchar*qlabel,
6464
StringInfostr,intindent,ExplainState*es);
65-
staticNode*make_ors_ands_explicit(List*orclauses);
6665

6766
/*
6867
* ExplainQuery -
@@ -405,7 +404,6 @@ explain_outNode(StringInfo str,
405404
Plan*outer_plan,
406405
intindent,ExplainState*es)
407406
{
408-
ListCell*l;
409407
char*pname;
410408
inti;
411409

@@ -583,19 +581,10 @@ explain_outNode(StringInfo str,
583581
switch (nodeTag(plan))
584582
{
585583
caseT_IndexScan:
586-
if (ScanDirectionIsBackward(((IndexScan*)plan)->indxorderdir))
584+
if (ScanDirectionIsBackward(((IndexScan*)plan)->indexorderdir))
587585
appendStringInfoString(str," Backward");
588-
appendStringInfoString(str," using ");
589-
i=0;
590-
foreach(l, ((IndexScan*)plan)->indxid)
591-
{
592-
char*indname;
593-
594-
indname=get_rel_name(lfirst_oid(l));
595-
appendStringInfo(str,"%s%s",
596-
(++i>1) ?", " :"",
597-
quote_identifier(indname));
598-
}
586+
appendStringInfo(str," using %s",
587+
quote_identifier(get_rel_name(((IndexScan*)plan)->indexid)));
599588
/* FALL THRU */
600589
caseT_SeqScan:
601590
caseT_BitmapHeapScan:
@@ -621,7 +610,7 @@ explain_outNode(StringInfo str,
621610
break;
622611
caseT_BitmapIndexScan:
623612
appendStringInfo(str," on %s",
624-
quote_identifier(get_rel_name(((BitmapIndexScan*)plan)->indxid)));
613+
quote_identifier(get_rel_name(((BitmapIndexScan*)plan)->indexid)));
625614
break;
626615
caseT_SubqueryScan:
627616
if (((Scan*)plan)->scanrelid>0)
@@ -702,27 +691,27 @@ explain_outNode(StringInfo str,
702691
switch (nodeTag(plan))
703692
{
704693
caseT_IndexScan:
705-
show_scan_qual(((IndexScan*)plan)->indxqualorig, true,
694+
show_scan_qual(((IndexScan*)plan)->indexqualorig,
706695
"Index Cond",
707696
((Scan*)plan)->scanrelid,
708697
outer_plan,
709698
str,indent,es);
710-
show_scan_qual(plan->qual, false,
699+
show_scan_qual(plan->qual,
711700
"Filter",
712701
((Scan*)plan)->scanrelid,
713702
outer_plan,
714703
str,indent,es);
715704
break;
716705
caseT_BitmapIndexScan:
717-
show_scan_qual(((BitmapIndexScan*)plan)->indxqualorig, false,
706+
show_scan_qual(((BitmapIndexScan*)plan)->indexqualorig,
718707
"Index Cond",
719708
((Scan*)plan)->scanrelid,
720709
outer_plan,
721710
str,indent,es);
722711
break;
723712
caseT_BitmapHeapScan:
724713
/* XXX do we want to show this in production? */
725-
show_scan_qual(((BitmapHeapScan*)plan)->bitmapqualorig, false,
714+
show_scan_qual(((BitmapHeapScan*)plan)->bitmapqualorig,
726715
"Recheck Cond",
727716
((Scan*)plan)->scanrelid,
728717
outer_plan,
@@ -732,7 +721,7 @@ explain_outNode(StringInfo str,
732721
caseT_TidScan:
733722
caseT_SubqueryScan:
734723
caseT_FunctionScan:
735-
show_scan_qual(plan->qual, false,
724+
show_scan_qual(plan->qual,
736725
"Filter",
737726
((Scan*)plan)->scanrelid,
738727
outer_plan,
@@ -997,7 +986,7 @@ explain_outNode(StringInfo str,
997986
* Show a qualifier expression for a scan plan node
998987
*/
999988
staticvoid
1000-
show_scan_qual(List*qual,boolis_or_qual,constchar*qlabel,
989+
show_scan_qual(List*qual,constchar*qlabel,
1001990
intscanrelid,Plan*outer_plan,
1002991
StringInfostr,intindent,ExplainState*es)
1003992
{
@@ -1012,14 +1001,9 @@ show_scan_qual(List *qual, bool is_or_qual, const char *qlabel,
10121001
/* No work if empty qual */
10131002
if (qual==NIL)
10141003
return;
1015-
if (is_or_qual&&list_length(qual)==1&&linitial(qual)==NIL)
1016-
return;
10171004

1018-
/* Fix qual --- indexqual requires different processing */
1019-
if (is_or_qual)
1020-
node=make_ors_ands_explicit(qual);
1021-
else
1022-
node= (Node*)make_ands_explicit(qual);
1005+
/* Convert AND list to explicit AND */
1006+
node= (Node*)make_ands_explicit(qual);
10231007

10241008
/* Generate deparse context */
10251009
Assert(scanrelid>0&&scanrelid <=list_length(es->rtable));
@@ -1177,26 +1161,3 @@ show_sort_keys(List *tlist, int nkeys, AttrNumber *keycols,
11771161

11781162
appendStringInfo(str,"\n");
11791163
}
1180-
1181-
/*
1182-
* Indexscan qual lists have an implicit OR-of-ANDs structure.Make it
1183-
* explicit so deparsing works properly.
1184-
*/
1185-
staticNode*
1186-
make_ors_ands_explicit(List*orclauses)
1187-
{
1188-
if (orclauses==NIL)
1189-
returnNULL;/* probably can't happen */
1190-
elseif (list_length(orclauses)==1)
1191-
return (Node*)make_ands_explicit(linitial(orclauses));
1192-
else
1193-
{
1194-
List*args=NIL;
1195-
ListCell*orptr;
1196-
1197-
foreach(orptr,orclauses)
1198-
args=lappend(args,make_ands_explicit(lfirst(orptr)));
1199-
1200-
return (Node*)make_orclause(args);
1201-
}
1202-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp