Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c15a4c2

Browse files
committed
Replace planner's representation of relation sets, per pghackers discussion.
Instead of Lists of integers, we now store variable-length bitmap sets. This should be faster as well as less error-prone.
1 parent 893678e commit c15a4c2

35 files changed

+1453
-626
lines changed

doc/src/sgml/indexcost.sgml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/indexcost.sgml,v 2.15 2003/01/28 22:13:24 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/indexcost.sgml,v 2.16 2003/02/08 20:20:53 tgl Exp $
33
-->
44

55
<chapter id="indexcost">
@@ -205,8 +205,7 @@ amcostestimate (Query *root,
205205

206206
<programlisting>
207207
*indexSelectivity = clauselist_selectivity(root, indexQuals,
208-
lfirsti(rel->relids),
209-
JOIN_INNER);
208+
rel->relid, JOIN_INNER);
210209
</programlisting>
211210
</para>
212211
</step>

src/backend/commands/explain.c

Lines changed: 9 additions & 3 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-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.100 2003/02/02 23:46:38 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.101 2003/02/08 20:20:53 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -775,12 +775,15 @@ show_scan_qual(List *qual, bool is_or_qual, const char *qlabel,
775775
*/
776776
if (outer_plan)
777777
{
778-
if (intMember(OUTER, pull_varnos(node)))
778+
Relids varnos = pull_varnos(node);
779+
780+
if (bms_is_member(OUTER, varnos))
779781
outercontext = deparse_context_for_subplan("outer",
780782
outer_plan->targetlist,
781783
es->rtable);
782784
else
783785
outercontext = NULL;
786+
bms_free(varnos);
784787
}
785788
else
786789
outercontext = NULL;
@@ -857,6 +860,7 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
857860
int keyno;
858861
List *tl;
859862
char *exprstr;
863+
Relids varnos;
860864
int i;
861865

862866
if (nkeys <= 0)
@@ -874,7 +878,8 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
874878
* there are Vars with zero varno, use the tlist itself to determine
875879
* their names.
876880
*/
877-
if (intMember(0, pull_varnos((Node *) tlist)))
881+
varnos = pull_varnos((Node *) tlist);
882+
if (bms_is_member(0, varnos))
878883
{
879884
Node *outercontext;
880885

@@ -893,6 +898,7 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
893898
es->rtable);
894899
useprefix = length(es->rtable) > 1;
895900
}
901+
bms_free(varnos);
896902

897903
for (keyno = 1; keyno <= nkeys; keyno++)
898904
{

src/backend/nodes/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
# Makefile for backend/nodes
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/nodes/Makefile,v 1.13 2000/08/31 16:10:06 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/nodes/Makefile,v 1.14 2003/02/08 20:20:53 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/backend/nodes
1212
top_builddir = ../../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
OBJS = nodeFuncs.o nodes.o list.o \
15+
OBJS = nodeFuncs.o nodes.o list.o bitmapset.o \
1616
copyfuncs.o equalfuncs.o makefuncs.o \
1717
outfuncs.o readfuncs.o print.o read.o
1818

0 commit comments

Comments
 (0)