gjacoby126 commented on code in PR #1495:
URL: https://github.com/apache/phoenix/pull/1495#discussion_r957929952


##########
phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java:
##########
@@ -308,6 +322,30 @@ public static Expression 
pushKeyExpressionsToScan(StatementContext context, Set<
                 slotSpanArray[cnf.size()] = clipLeftSpan-1;
                 cnf.add(keyRanges);
             }
+
+            // Do not use the skipScanFilter when there is a large IN clause 
(for e.g > 50k elements)
+            // Since the generation of point keys for skip scan filter will 
blow up the memory usage.
+            // See ScanRanges.getPointKeys(...) where using the various slot 
key ranges
+            // to generate point keys will lead to combinatorial explosion.
+            // The following check will ensure the cardinality of generated 
point keys
+            // is below the configured max (maxInListSkipScanSize).
+            // We shall force a range scan if the configured max is exceeded.
+            // cnfStartPos => is the start slot of this IN list
+            if (checkMaxSkipScanCardinality) {

Review Comment:
   There's already a config param to control how many elements triggers the 
conversion, which could be used to turn it off by setting it very high. 
However, when we get in this state (high cardinality skip scans) we find that 
we get OOM exceptions even with large client-side heaps, which is worse than a 
slow query. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to