You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2013/06/13 14:30:37 UTC
svn commit: r1492641 - in /db/derby/code/trunk/java:
engine/org/apache/derby/ engine/org/apache/derby/impl/sql/compile/
testing/org/apache/derbyTesting/functionTests/harness/
Author: rhillegas
Date: Thu Jun 13 12:30:36 2013
New Revision: 1492641
URL: http://svn.apache.org/r1492641
Log:
DERBY-6259: Commit derby-6259-01-aa-collapseOptimizers.diff, eliminating the level 2 optimizer.
Removed:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Level2CostEstimateImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Level2OptimizerFactoryImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Level2OptimizerImpl.java
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/modules.properties
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java?rev=1492641&r1=1492640&r2=1492641&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java Thu Jun 13 12:30:36 2013
@@ -325,4 +325,12 @@ public class CostEstimateImpl implements
return retval;
}
+
+ public String toString()
+ {
+ return "CostEstimateImpl: at " + hashCode() + ", cost == " + cost +
+ ", rowCount == " + rowCount +
+ ", singleScanRowCount == " + singleScanRowCount;
+ }
+
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java?rev=1492641&r1=1492640&r2=1492641&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java Thu Jun 13 12:30:36 2013
@@ -181,7 +181,7 @@ public class OptimizerFactoryImpl
*/
public boolean supportsOptimizerTrace()
{
- return false;
+ return true;
}
//
@@ -210,7 +210,8 @@ public class OptimizerFactoryImpl
joinStrategySet,
lcc.getLockEscalationThreshold(),
requiredRowOrdering,
- numTablesInQuery);
+ numTablesInQuery,
+ lcc);
}
/**
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java?rev=1492641&r1=1492640&r2=1492641&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java Thu Jun 13 12:30:36 2013
@@ -53,12 +53,6 @@ import org.apache.derby.iapi.util.String
import java.util.HashMap;
/**
- * This will be the Level 1 Optimizer.
- * RESOLVE - it's a level 0 optimizer right now.
- * Current State:
- * o No costing services
- * o We can only cost a derived table with a join once.
- *
* Optimizer uses OptimizableList to keep track of the best join order as it
* builds it. For each available slot in the join order, we cost all of the
* Optimizables from that slot til the end of the OptimizableList. Later,
@@ -210,7 +204,8 @@ public class OptimizerImpl implements Op
JoinStrategy[] joinStrategies,
int tableLockThreshold,
RequiredRowOrdering requiredRowOrdering,
- int numTablesInQuery)
+ int numTablesInQuery,
+ LanguageConnectionContext lcc )
throws StandardException
{
if (SanityManager.DEBUG) {
@@ -256,6 +251,7 @@ public class OptimizerImpl implements Op
this.tableLockThreshold = tableLockThreshold;
this.requiredRowOrdering = requiredRowOrdering;
this.useStatistics = useStatistics;
+ this.lcc = lcc;
/* initialize variables for tracking permutations */
assignedTableMap = new JBitSet(numTablesInQuery);
@@ -281,6 +277,9 @@ public class OptimizerImpl implements Op
usingPredsPushedFromAbove = false;
bestJoinOrderUsedPredsFromAbove = false;
+
+ // Optimization started
+ if (tracingIsOn()) { tracer().traceStart( timeOptimizationStarted, hashCode(), optimizableList ); }
}
/**
@@ -2613,7 +2612,7 @@ public class OptimizerImpl implements Op
/** @see Optimizer#getLevel */
public int getLevel()
{
- return 1;
+ return 2;
}
public CostEstimateImpl getNewCostEstimate(double theCost,
Modified: db/derby/code/trunk/java/engine/org/apache/derby/modules.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/modules.properties?rev=1492641&r1=1492640&r2=1492641&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/modules.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/modules.properties Thu Jun 13 12:30:36 2013
@@ -264,24 +264,12 @@ derby.module.XPLAINFactory=org.apache.de
cloudscape.config.XPLAINFactory=all
-derby.module.optimizer=org.apache.derby.impl.sql.compile.Level2OptimizerFactoryImpl
+derby.module.optimizer=org.apache.derby.impl.sql.compile.OptimizerFactoryImpl
#
# cloudscape.config.optimizer=derby
#
cloudscape.config.optimizer=all
-# use level1 optimizer for small configurations
-#
-# can't do this in the codeline because with 2 implementations, it is entirely
-# by chance which get picked. So we may be running with different modules
-# depending on which jdk
-#
-# to be resolve by Siuling and Dan
-#
-#derby.module.optimizerSmall=org.apache.derby.impl.sql.compile.OptimizerFactoryImpl
-#cloudscape.config.optimizerSmall=cloud,cloudtarget
-
-
#####################################################
# Database Property Validation
#####################################################
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java?rev=1492641&r1=1492640&r2=1492641&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java Thu Jun 13 12:30:36 2013
@@ -153,7 +153,7 @@ public class Sed
searchStrings.addElement("^The selected victim is XID : .*");
// Filters for build numbers
searchStrings.addElement("(beta - )\\(([0-9]*)\\)");
- searchStrings.addElement("Level2CostEstimateImpl: .*");
+ searchStrings.addElement("CostEstimateImpl: .*");
// Filter for xa tests for the numbers representing the db name (it can change)
searchStrings.addElement("^Transaction ([0-9])* : \\(([0-9]*)\\,([0-9a-f]*)\\,([0-9a-f]*)\\)");
// Filter for optimizer number for zindexesLevel1 test (due to a change in display width for the test)
@@ -224,7 +224,7 @@ public class Sed
subStrings.addElement("The selected victim is XID : VVV");
// sub build numbers
subStrings.addElement("$1(xxXXxxFILTERED-BUILD-NUMBERxxXXxx)");
- subStrings.addElement("Level2CostEstimateImpl: xxXXxxFILTERED-INFORMATIONxxXXxx");
+ subStrings.addElement("CostEstimateImpl: xxXXxxFILTERED-INFORMATIONxxXXxx");
// sub for db name in xa tests (it can change)
subStrings.addElement("Transaction $1 : ($2,FILTERED,FILTERED)");
// sub for optimizer number for zindexesLevel1 test