// skip the meat if this isn't a scan node
if ( ! (plan instanceof SeqScanPlanNode)) {
return plan;
}
SeqScanPlanNode scanNode = (SeqScanPlanNode) plan;
if (scanNode.isSubQuery()) {
// This is a sub-query and can't have indexes
return plan;
}
// got here? we're got ourselves a sequential scan over a real table
assert (scanNode.getChildCount() == 0);
StmtTableScan tableScan = scanNode.getTableScan();
assert(tableScan != null);
Index indexToScan = null;
// Pick the narrowest index from all of the unique tree indexes.