core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExecutionPlanCache.java
public static OExecutionPlan get(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) {
    if (db == null) {
      throw new IllegalArgumentException("DB cannot be null");
    }
    if (statement == null) {
      return null;
    }

    OExecutionPlanCache resource = db.getSharedContext().getExecutionPlanCache();
    OExecutionPlan result = resource.getInternal(statement, ctx, db);
    return result;
  }
public static OExecutionPlan get(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) {
    if (db == null) {
      throw new IllegalArgumentException("DB cannot be null");
    }
    if (statement == null) {
      return null;
    }

    OExecutionPlanCache resource = db.getSharedContext().getExecutionPlanCache();
    OExecutionPlan result = resource.getInternal(statement, ctx, db);
    return result;
  }
returns an already prepared SQL execution plan, taking it from the cache if it exists or creating a new one if it doesn't

@param statement the SQL statement
@param ctx
@param db        the current DB instance

@return a statement executor from the cache