From 9c29c1190a6e70e5a1c200ca1ed1f403b7c56ead Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 6 Sep 2006 15:06:46 +0000 Subject: Short-circuit if re-calc eliminates needs for union. --- src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/com/amazon/carbonado') diff --git a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java index 2f467eb..9ed94fd 100644 --- a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java +++ b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java @@ -111,6 +111,11 @@ public class UnionQueryAnalyzer { // Re-calc with specified direction. Only do one property at a time // since one simple change might alter the query plan. subResults = splitIntoSubResults(filter, orderings); + + if (subResults.size() < 1) { + // Total ordering no longer required. + return new Result(subResults); + } } // Gather all the keys available. As ordering properties touch key @@ -178,6 +183,11 @@ public class UnionQueryAnalyzer { orderings.add(OrderedProperty.get(bestProperty, best.getBestDirection())); subResults = splitIntoSubResults(filter, orderings); + if (subResults.size() < 1) { + // Total ordering no longer required. + break; + } + // Remove property from super key and key set... superKey.remove(bestProperty); if (superKey.size() == 0) { -- cgit v1.2.3