You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hz...@apache.org on 2017/05/22 17:13:03 UTC

[1/2] incubator-trafodion git commit: [TRAFODION-2618] Option to skip rowcount estimation in update stats

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master d3c0bb9b1 -> 9d945faf3


[TRAFODION-2618] Option to skip rowcount estimation in update stats

Don't call the rowcount estimation interface when the SET ROWCOUNT
option is specified, we will discard that estimate anyway.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/790b04ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/790b04ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/790b04ac

Branch: refs/heads/master
Commit: 790b04acbe25bf3b3bd304777caa03c7d2f30d3f
Parents: d4677b5
Author: Hans Zeller <hz...@apache.org>
Authored: Thu May 18 20:45:00 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Thu May 18 20:45:00 2017 +0000

----------------------------------------------------------------------
 core/sql/ustat/hs_globals.cpp | 44 ++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/790b04ac/core/sql/ustat/hs_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index fa2d8bf..795885f 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -3298,13 +3298,30 @@ Lng32 HSGlobalsClass::Initialize()
     LM->StartTimer("getRowCount()");
     Int32 errorCode = 0;
     Int32 breadCrumb = 0;
-    actualRowCount = objDef->getRowCount(currentRowCountIsEstimate_,
-                                         inserts, deletes, updates,
-                                         numPartitions,
-                                         minRowCtPerPartition_,
-                                         errorCode /* out */,
-                                         breadCrumb /* out */,
-                                         optFlags & (SAMPLE_REQUESTED | IUS_OPT));
+    if ((optFlags & ROWCOUNT_OPT) == 0)
+      actualRowCount = objDef->getRowCount(currentRowCountIsEstimate_,
+                                           inserts, deletes, updates,
+                                           numPartitions,
+                                           minRowCtPerPartition_,
+                                           errorCode /* out */,
+                                           breadCrumb /* out */,
+                                           optFlags & (SAMPLE_REQUESTED | IUS_OPT));
+    else
+      {
+        // skip the potentially expensive step of determining the row
+        // count, if it was specified by the user
+        actualRowCount = userSuppliedRowCount;
+        currentRowCountIsEstimate_ = FALSE;
+        inserts = deletes = updates = 0;
+        numPartitions = 1;
+        minRowCtPerPartition_ = actualRowCount;
+        if (LM->LogNeeded())
+          {
+            convertInt64ToAscii(actualRowCount, intStr);
+            sprintf(LM->msg, "\t\t\tUser provided rowcount: rows=%s", intStr);
+            LM->Log(LM->msg);
+          }
+      }
     LM->StopTimer();
     if (LM->LogNeeded())
       {
@@ -3343,18 +3360,7 @@ Lng32 HSGlobalsClass::Initialize()
     // place of the estimate, unless the user supplied his own row count..
     if (currentRowCountIsEstimate_ && !(optFlags & CLEAR_OPT))
       {
-        if (optFlags & ROWCOUNT_OPT)                /* rowcount provided */
-          {
-            actualRowCount = userSuppliedRowCount;
-            currentRowCountIsEstimate_ = FALSE;
-            if (LM->LogNeeded())
-              {
-                convertInt64ToAscii(actualRowCount, intStr);
-                sprintf(LM->msg, "\t\t\tUser provided rowcount: rows=%s", intStr);
-                LM->Log(LM->msg);
-              }
-          }
-        else if (convertInt64ToDouble(actualRowCount) <   // may be 0 (no estimate) or -1 (error doing estimation)
+        if (convertInt64ToDouble(actualRowCount) <   // may be 0 (no estimate) or -1 (error doing estimation)
                      CmpCommon::getDefaultNumeric(USTAT_MIN_ESTIMATE_FOR_ROWCOUNT))
           {
             if (LM->LogNeeded() && actualRowCount > 0)


[2/2] incubator-trafodion git commit: Merge [TRAFODION-2618] Option to skip rowcount estimation in update stats PR-1100

Posted by hz...@apache.org.
Merge [TRAFODION-2618] Option to skip rowcount estimation in update stats PR-1100


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9d945faf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9d945faf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9d945faf

Branch: refs/heads/master
Commit: 9d945faf359442db56f6f9f1c2fd365188745d96
Parents: d3c0bb9 790b04a
Author: Hans Zeller <hz...@apache.org>
Authored: Mon May 22 17:12:29 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Mon May 22 17:12:29 2017 +0000

----------------------------------------------------------------------
 core/sql/ustat/hs_globals.cpp | 44 ++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 19 deletions(-)
----------------------------------------------------------------------