db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abr...@apache.org
Subject svn commit: r604513 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java
Date Sat, 15 Dec 2007 20:49:10 GMT
Author: abrown
Date: Sat Dec 15 12:49:09 2007
New Revision: 604513

URL: http://svn.apache.org/viewvc?rev=604513&view=rev
Log:
DERBY-3214: Follow-up patch to fix a bug in the first commit.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java

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=604513&r1=604512&r2=604513&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 Sat
Dec 15 12:49:09 2007
@@ -875,7 +875,7 @@
 						if (joinPosition == 0)
 							newCost = 0.0;
 						else
-							newCost = recoverCostFromProposedJoinOrder();
+							newCost = recoverCostFromProposedJoinOrder(false);
 					}
 				}
 
@@ -958,7 +958,7 @@
 							else
 							{
 								prevEstimatedCost =
-									recoverCostFromProposedJoinOrder();
+									recoverCostFromProposedJoinOrder(true);
 							}
 						}
 
@@ -1274,15 +1274,26 @@
 	 * to recover the "1500" that we lost in the process of adding and
 	 * subtracting 3.14E40.
 	 */
-	private double recoverCostFromProposedJoinOrder()
+	private double recoverCostFromProposedJoinOrder(boolean sortAvoidance)
 		throws StandardException
 	{
 		double recoveredCost = 0.0d;
 		for (int i = 0; i < joinPosition; i++)
 		{
-			recoveredCost +=
-				optimizableList.getOptimizable(proposedJoinOrder[i])
-					.getBestAccessPath().getCostEstimate().getEstimatedCost();
+			if (sortAvoidance)
+			{
+				recoveredCost +=
+					optimizableList.getOptimizable(proposedJoinOrder[i])
+						.getBestSortAvoidancePath().getCostEstimate()
+							.getEstimatedCost();
+			}
+			else
+			{
+				recoveredCost +=
+					optimizableList.getOptimizable(proposedJoinOrder[i])
+						.getBestAccessPath().getCostEstimate()
+							.getEstimatedCost();
+			}
 		}
 
 		return recoveredCost;



Mime
View raw message