Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/281#discussion_r151014001 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java --- @@ -500,7 +500,10 @@ public ExplainPlan getExplainPlan() throws SQLException { if (context.getScanRanges() == ScanRanges.NOTHING) { return new ExplainPlan(Collections.singletonList("DEGENERATE SCAN OVER " + getTableRef().getTable().getName().getString())); } - + + // Initialize dummy iterator to get the stats. --- End diff -- Comment that you need the stats prior to optimization as they help drive cost based decisions.
---