Update mark/reset index code for multiple indexes, (OR code).
authorBruce Momjian
Mon, 3 Aug 1998 19:41:35 +0000 (19:41 +0000)
committerBruce Momjian
Mon, 3 Aug 1998 19:41:35 +0000 (19:41 +0000)
Thanks for Vadim for fixes.

src/backend/executor/nodeIndexscan.c
src/include/nodes/execnodes.h
src/tools/backend/flow.fig
src/tools/backend/flow.jpg
src/tools/backend/index.html

index f964c18f8cb59b0ee91adbe711f02a7b711a9350..074943174f52d7072e58401800216ff91b3b8681 100644 (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++)
        {
-           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);
+
                /*
-                * 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.
+                * pass in isDone but ignore it.  We don't iterate in
+                * quals
                 */
-               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;
-               }
+               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];
 
index 533024e5833b0cb786f738c5877c228e19479e42..c582cdd7994589ede210ffd63fa354264cf298ff 100644 (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;
index c12880ef0587d08b8de449f5dddcd92a20501a94..87b9df8e6b802d1441ec6d04e273cdd41104b684 100644 (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
index dba7dcd5f7791d15662bb19c1e4af70d42b1abfb..d2cfb67acc022b0a089a698f3a26fde9f25d1989 100644 (file)
Binary files a/src/tools/backend/flow.jpg and b/src/tools/backend/flow.jpg differ
index 1942e729f5b65d6f035050b10cd7a4730cbe185c..8a3244b6d6c536975bb8c5d19e94c8c73e5d12f6 100644 (file)
@@ -11,10 +11,6 @@ by Bruce Momjian
 
 

 
-
-Click on an item to see more detail or look at the full
-index.
-
 
 
 
@@ -38,10 +34,12 @@ Click on an item to see more detail or look at the full
 
 
 
+
+Click on an item to see more detail or look at the full
+index.
+
 
-

 
-
 

 
 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.

 
 
 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: