From df986362a47fa9c3e9243e5c5de2153889d2f103 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 19 Jan 2007 00:42:05 +0000 Subject: Added additional index selection tie-breaker if index is most likely defined to support desired ordering. --- src/main/java/com/amazon/carbonado/qe/CompositeScore.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/amazon') diff --git a/src/main/java/com/amazon/carbonado/qe/CompositeScore.java b/src/main/java/com/amazon/carbonado/qe/CompositeScore.java index 9992690..e031fe2 100644 --- a/src/main/java/com/amazon/carbonado/qe/CompositeScore.java +++ b/src/main/java/com/amazon/carbonado/qe/CompositeScore.java @@ -224,8 +224,18 @@ public class CompositeScore { return preferenceResult; } - // Preference scores are the same? That seems unlikely, but - // choose the better filtering index. + // Okay, preference is not helping. If handled filter count is + // the same, choose the better ordering. Why? Most likely a nearly + // identical index was created specifically for ordering. One index + // might look better for filtering just because it is clustered. + + if (firstScore.getHandledCount() == secondScore.getHandledCount()) { + if (handledScore != 0) { + return handledScore; + } + } + + // Just return the result for the better filtering index. return result; } -- cgit v1.2.3