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

Commit3c92658

Browse files
committed
Remove EState.es_range_table_array.
Now that list_nth is O(1), there's no good reason to maintain aseparate array of RTE pointers rather than indexing intoestate->es_range_table. Deleting the array doesn't save all thatmuch either; but just on cleanliness grounds, it's better not tohave duplicate representations of the identical information.Discussion:https://postgr.es/m/14960.1565384592@sss.pgh.pa.us
1 parent5ee190f commit3c92658

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

‎src/backend/executor/execMain.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,6 @@ EvalPlanQualStart(EPQState *epqstate, EState *parentestate, Plan *planTree)
27902790
estate->es_snapshot=parentestate->es_snapshot;
27912791
estate->es_crosscheck_snapshot=parentestate->es_crosscheck_snapshot;
27922792
estate->es_range_table=parentestate->es_range_table;
2793-
estate->es_range_table_array=parentestate->es_range_table_array;
27942793
estate->es_range_table_size=parentestate->es_range_table_size;
27952794
estate->es_relations=parentestate->es_relations;
27962795
estate->es_queryEnv=parentestate->es_queryEnv;

‎src/backend/executor/execUtils.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ CreateExecutorState(void)
113113
estate->es_snapshot=InvalidSnapshot;/* caller must initialize this */
114114
estate->es_crosscheck_snapshot=InvalidSnapshot;/* no crosscheck */
115115
estate->es_range_table=NIL;
116-
estate->es_range_table_array=NULL;
117116
estate->es_range_table_size=0;
118117
estate->es_relations=NULL;
119118
estate->es_rowmarks=NULL;
@@ -720,29 +719,17 @@ ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
720719
* ExecInitRangeTable
721720
*Set up executor's range-table-related data
722721
*
723-
* We build an array from the range table list to allow faster lookup by RTI.
724-
* (The es_range_table field is now somewhat redundant, but we keep it to
725-
* avoid breaking external code unnecessarily.)
726-
* This is also a convenient place to set up the parallel es_relations array.
722+
* In addition to the range table proper, initialize arrays that are
723+
* indexed by rangetable index.
727724
*/
728725
void
729726
ExecInitRangeTable(EState*estate,List*rangeTable)
730727
{
731-
Indexrti;
732-
ListCell*lc;
733-
734728
/* Remember the range table List as-is */
735729
estate->es_range_table=rangeTable;
736730

737-
/* Setup the equivalent array representation */
731+
/* Setsize of associated arrays */
738732
estate->es_range_table_size=list_length(rangeTable);
739-
estate->es_range_table_array= (RangeTblEntry**)
740-
palloc(estate->es_range_table_size*sizeof(RangeTblEntry*));
741-
rti=0;
742-
foreach(lc,rangeTable)
743-
{
744-
estate->es_range_table_array[rti++]=lfirst_node(RangeTblEntry,lc);
745-
}
746733

747734
/*
748735
* Allocate an array to store an open Relation corresponding to each
@@ -753,8 +740,8 @@ ExecInitRangeTable(EState *estate, List *rangeTable)
753740
palloc0(estate->es_range_table_size*sizeof(Relation));
754741

755742
/*
756-
* es_rowmarks is also parallel to thees_range_table_array, but it's
757-
*allocatedonly if needed.
743+
* es_rowmarks is also parallel to thees_range_table, but it's allocated
744+
* only if needed.
758745
*/
759746
estate->es_rowmarks=NULL;
760747
}

‎src/include/executor/executor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,7 @@ extern void ExecInitRangeTable(EState *estate, List *rangeTable);
535535
staticinlineRangeTblEntry*
536536
exec_rt_fetch(Indexrti,EState*estate)
537537
{
538-
Assert(rti>0&&rti <=estate->es_range_table_size);
539-
returnestate->es_range_table_array[rti-1];
538+
return (RangeTblEntry*)list_nth(estate->es_range_table,rti-1);
540539
}
541540

542541
externRelationExecGetRangeTableRelation(EState*estate,Indexrti);

‎src/include/nodes/execnodes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ typedef struct EState
502502
Snapshotes_snapshot;/* time qual to use */
503503
Snapshotes_crosscheck_snapshot;/* crosscheck time qual for RI */
504504
List*es_range_table;/* List of RangeTblEntry */
505-
structRangeTblEntry**es_range_table_array;/* equivalent array */
506505
Indexes_range_table_size;/* size of the range table arrays */
507506
Relation*es_relations;/* Array of per-range-table-entry Relation
508507
* pointers, or NULL if not yet opened */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp