Update mark/reset index code for multiple indexes, (OR code).

Thanks for Vadim for fixes.
This commit is contained in:
Bruce Momjian 1998-08-03 19:41:35 +00:00
parent 21ad8695ca
commit 439a2af0bc
5 changed files with 104 additions and 111 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.21 1998/08/01 22:44:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.22 1998/08/03 19:41:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -258,9 +258,8 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
if (exprCtxt == NULL)
exprCtxt = node->scan.scanstate->cstate.cs_ExprContext;
if (exprCtxt != NULL)
node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple =
exprCtxt->ecxt_outertuple;
node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple =
exprCtxt->ecxt_outertuple;
/*
* get the index qualifications and recalculate the appropriate
@ -268,43 +267,40 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
*/
for (i = 0; i < numIndices; i++)
{
if (runtimeKeyInfo && runtimeKeyInfo[i] != NULL)
{
qual = nth(i, indxqual);
n_keys = numScanKeys[i];
run_keys = (int *) runtimeKeyInfo[i];
scan_keys = (ScanKey) scanKeys[i];
for (j = 0; j < n_keys; j++)
{
/*
* If we have a run-time key, then extract the run-time
* expression and evaluate it with respect to the current
* outer tuple. We then stick the result into the scan key.
*/
if (run_keys[j] != NO_OP)
{
clause = nth(j, qual);
scanexpr = (run_keys[j] == RIGHT_OP) ?
(Node *) get_rightop(clause) : (Node *) get_leftop(clause);
qual = nth(i, indxqual);
n_keys = numScanKeys[i];
run_keys = (int *) runtimeKeyInfo[i];
scan_keys = (ScanKey) scanKeys[i];
/*
* pass in isDone but ignore it. We don't iterate in
* quals
*/
scanvalue = (Datum)
ExecEvalExpr(scanexpr, exprCtxt, &isNull, &isDone);
scan_keys[j].sk_argument = scanvalue;
if (isNull)
scan_keys[j].sk_flags |= SK_ISNULL;
else
scan_keys[j].sk_flags &= ~SK_ISNULL;
}
for (j = 0; j < n_keys; j++)
{
/*
* If we have a run-time key, then extract the run-time
* expression and evaluate it with respect to the current
* outer tuple. We then stick the result into the scan key.
*/
if (run_keys[j] != NO_OP)
{
clause = nth(j, qual);
scanexpr = (run_keys[j] == RIGHT_OP) ?
(Node *) get_rightop(clause) : (Node *) get_leftop(clause);
/*
* pass in isDone but ignore it. We don't iterate in
* quals
*/
scanvalue = (Datum)
ExecEvalExpr(scanexpr, exprCtxt, &isNull, &isDone);
scan_keys[j].sk_argument = scanvalue;
if (isNull)
scan_keys[j].sk_flags |= SK_ISNULL;
else
scan_keys[j].sk_flags &= ~SK_ISNULL;
}
sdesc = scanDescs[i];
skey = scanKeys[i];
index_rescan(sdesc, direction, skey);
}
sdesc = scanDescs[i];
skey = scanKeys[i];
index_rescan(sdesc, direction, skey);
}
/* ----------------
* perhaps return something meaningful
@ -416,7 +412,7 @@ ExecIndexMarkPos(IndexScan *node)
int indexPtr;
indexstate = node->indxstate;
indexPtr = indexstate->iss_IndexPtr;
indexPtr = indexstate->iss_MarkIndexPtr = indexstate->iss_IndexPtr;
indexScanDescs = indexstate->iss_ScanDescs;
scanDesc = indexScanDescs[indexPtr];
@ -445,7 +441,7 @@ ExecIndexRestrPos(IndexScan *node)
int indexPtr;
indexstate = node->indxstate;
indexPtr = indexstate->iss_IndexPtr;
indexPtr = indexstate->iss_IndexPtr = indexstate->iss_MarkIndexPtr;
indexScanDescs = indexstate->iss_ScanDescs;
scanDesc = indexScanDescs[indexPtr];

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: execnodes.h,v 1.16 1998/07/27 19:38:34 vadim Exp $
* $Id: execnodes.h,v 1.17 1998/08/03 19:41:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -399,6 +399,7 @@ typedef struct IndexScanState
CommonState cstate; /* its first field is NodeTag */
int iss_NumIndices;
int iss_IndexPtr;
int iss_MarkIndexPtr;
ScanKey *iss_ScanKeys;
int *iss_NumScanKeys;
Pointer iss_RuntimeKeyInfo;

View File

@ -8,85 +8,63 @@ Inches
4 0 -1 0 0 0 24 0.0000 4 330 1800 450 675 PostgreSQL\001
4 0 -1 0 0 0 24 0.0000 4 330 1290 450 1095 Program\001
-6
6 5325 13125 7725 14400
2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5
7725 14400 5325 14400 5325 13800 7725 13800 7725 14400
2 1 0 1 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
6450 13200 6450 13800
-6
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
8475 2175
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
8475 2175
2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5
2850 13200 450 13200 450 12600 2850 12600 2850 13200
2 1 0 1 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
1650 12600 1650 12000
2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5
9225 13200 6825 13200 6825 12600 9225 12600 9225 13200
2 1 0 1 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
8025 11925 8025 12525
2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5
6000 13200 3600 13200 3600 12600 6000 12600 6000 13200
2 1 0 1 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
4800 12600 4800 12000
2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5
4425 14400 2025 14400 2025 13800 4425 13800 4425 14400
2 1 0 1 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
3225 13200 3225 13800
2 1 0 1 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 6675 2625 7275
2 1 0 1 19 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2625 2775 2625 3375
2 4 0 1 -1 4 0 0 20 0.000 0 0 7 0 0 5
3825 3975 1425 3975 1425 3375 3825 3375 3825 3975
2 1 0 1 20 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2625 3975 2625 4575
2 1 0 1 20 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2625 3975 6525 4575
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
3825 6675 1425 6675 1425 6075 3825 6075 3825 6675
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
3825 7875 1425 7875 1425 7275 3825 7275 3825 7875
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
3825 9075 1425 9075 1425 8475 3825 8475 3825 9075
2 1 0 1 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 7875 2625 8475
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
3825 10275 1425 10275 1425 9675 3825 9675 3825 10275
2 1 0 1 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 9075 2625 9675
2 1 0 1 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 10275 2625 10875
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
7725 7875 5325 7875 5325 7275 7725 7275 7725 7875
2 1 0 1 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
3825 7575 5325 7575
2 1 0 1 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 5775 2625 6075
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
3825 11475 1425 11475 1425 10875 3825 10875 3825 11475
2 1 0 1 31 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
2 1 0 2 31 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 5175 2625 5775
2 4 0 1 -1 31 0 0 20 0.000 0 0 7 0 0 5
3825 5175 1425 5175 1425 4575 3825 4575 3825 5175
@ -96,24 +74,44 @@ Inches
8775 11775 375 11775 375 5625 8775 5625 8775 11775
2 4 0 1 -1 0 0 0 20 0.000 0 0 7 0 0 5
7725 3375 5325 3375 5325 2775 7725 2775 7725 3375
2 1 1 1 -1 7 0 0 -1 3.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
4660 3324 5295 3093
2 1 1 1 -1 7 0 0 -1 4.000 0 0 -1 1 1 2
0 0 1.00 60.00 120.00
0 0 1.00 60.00 120.00
4890 3708 5325 3150
2 4 0 1 -1 26 0 0 20 0.000 0 0 7 0 0 5
3825 2775 1425 2775 1425 2175 3825 2175 3825 2775
2 4 0 1 -1 23 0 0 20 0.000 0 0 8 0 0 5
2925 15675 525 15675 525 15075 2925 15075 2925 15675
3 0 0 1 8 7 0 0 -1 0.000 0 1 0 5
0 0 1.00 60.00 120.00
7725 7575 8325 7275 8325 6375 7950 5775 2625 5775
3 0 0 1 8 7 0 0 -1 0.000 0 1 0 5
0 0 1.00 60.00 120.00
1425 11175 750 10725 750 6225 1425 5775 2625 5775
2 1 0 2 25 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.50
2625 2775 2625 3375
2 4 0 1 -1 26 0 0 20 0.000 0 0 7 0 0 5
3825 2775 1425 2775 1425 2175 3825 2175 3825 2775
2 1 0 2 20 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 3975 2625 4575
2 1 0 2 20 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
2625 3975 6525 4575
2 1 1 2 -1 7 0 0 -1 4.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
4890 3708 5325 3150
2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5
7725 14400 5325 14400 5325 13800 7725 13800 7725 14400
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
6450 13200 6450 13800
2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2
0 0 2.00 150.00 180.00
3825 7575 5325 7575
2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5
3825 7875 1425 7875 1425 7275 3825 7275 3825 7875
2 1 1 2 -1 7 0 0 -1 3.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00
0 0 2.00 150.00 180.00
4735 3324 5370 3093
3 0 0 2 8 7 0 0 -1 0.000 0 1 0 5
0 0 2.00 150.00 180.00
7725 7575 8325 7275 8325 6375 7800 5775 2625 5775
3 0 0 2 8 7 0 0 -1 0.000 0 1 0 5
0 0 2.00 150.00 180.00
1425 11175 825 10725 825 6225 1575 5775 2625 5775
4 1 -1 0 0 28 18 0.0000 4 195 1050 1635 12990 Utilities\001
4 1 -1 0 0 28 18 0.0000 4 240 2325 8040 12990 Storage Managers\001
4 1 -1 0 0 0 18 0.0000 4 255 840 4800 12975 Catalog\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -11,10 +11,6 @@ by Bruce Momjian
</H2>
<P>
<CENTER>
<EM><BIG>
Click on an item to see more detail or look at the full
<A HREF="backend_dirs.html">index.</A>
</BIG></EM>
<BR>
<BR>
<IMG src="flow.jpg" usemap="#flowmap" alt="flowchart">
@ -38,10 +34,12 @@ Click on an item to see more detail or look at the full
<AREA COORDS="340,900,500,950" HREF="backend_dirs.html#nodes">
<AREA COORDS="20,990,180,1030" HREF="backend_dirs.html#bootstrap">
</MAP>
<CENTER><EM>
Click on an item to see more detail or look at the full
<A HREF="backend_dirs.html">index.</A>
</EM></CENTER>
<BR>
<P>
<HR>
<P>
A query comes to the backend via data packets arriving through TCP/IP or
@ -117,8 +115,8 @@ can be accessed by clicking on the flowchart.<P>
Another area of interest is the shared memory area, which contains data
accessable to all backends. It has table recently used data/index
blocks, locks, backend information, and lookup tables for these
accessable to all backends. It has recently used data/index blocks,
locks, backend process information, and lookup tables for these
structures:
<UL>