Class QueryExecutionType

java.lang.Object
org.neo4j.graphdb.QueryExecutionType

public final class QueryExecutionType extends Object
Signifies how a query is executed, as well as what side effects and results could be expected from the query.

In Cypher there are three different modes of execution:

  • Normal execution,
  • execution with the PROFILE directive, and
  • execution with the EXPLAIN directive.
Instances of this class contain the required information to be able to tell these different execution modes apart. It also contains information about what effects the query could have, and whether it could yield any results, in form of the QueryType enum.

Queries executed with the PROFILE directive can have side effects and produce results in the same way as a normally executed method. The difference being that the user has expressed an interest in seeing the plan used to execute the query, and that this plan will (after execution completes) be annotated with profiling information from the execution of the query.

Queries executed with the EXPLAIN directive never have any side effects, nor do they ever yield any rows in the results, the sole purpose of this mode of execution is to get a description of the plan that would be executed if/when the query is executed normally (or under PROFILE).

  • Method Details

    • query

      Get the QueryExecutionType that signifies normal execution of a query of the supplied type.
      Parameters:
      type - the type of query executed.
      Returns:
      The instance that signifies normal execution of the supplied QueryExecutionType.QueryType.
    • profiled

      public static QueryExecutionType profiled(QueryExecutionType.QueryType type)
      Get the QueryExecutionType that signifies profiled execution of a query of the supplied type.
      Parameters:
      type - the type of query executed.
      Returns:
      The instance that signifies profiled execution of the supplied QueryExecutionType.QueryType.
    • explained

      public static QueryExecutionType explained(QueryExecutionType.QueryType type)
      Get the QueryExecutionType that signifies explaining the plan of a query of the supplied type.
      Parameters:
      type - the type of query executed.
      Returns:
      The instance that signifies explaining the plan of the supplied QueryExecutionType.QueryType.
    • queryType

      public QueryExecutionType.QueryType queryType()
      Get the type of query this execution refers to.
      Returns:
      the type of query this execution refers to.
    • isProfiled

      public boolean isProfiled()
      Signifies whether results from this execution contains profiling information. This is true for queries executed with the PROFILE directive.
      Returns:
      true if the results from this execution would contain profiling information.
    • requestedExecutionPlanDescription

      public boolean requestedExecutionPlanDescription()
      Signifies whether the supplied query contained a directive that asked for a description of the execution plan. This is true for queries executed with either the EXPLAIN or PROFILE directives.
      Returns:
      true if a description of the plan should be presented to the user.
    • isExplained

      public boolean isExplained()
      Signifies that the query was executed with the EXPLAIN directive.
      Returns:
      true if the query was executed using the EXPLAIN directive.
    • canContainResults

      public boolean canContainResults()
      Signifies that the execution of the query could produce a result. This is an important distinction from the result being empty.
      Returns:
      true if the execution would yield rows in the result set.
    • canUpdateData

      public boolean canUpdateData()
      Signifies that the execution of the query could perform changes to the data. Result.getQueryStatistics().containsUpdates() signifies whether the query actually performed any updates.
      Returns:
      true if the execution could perform changes to data.
    • canUpdateSchema

      public boolean canUpdateSchema()
      Signifies that the execution of the query updates the schema.
      Returns:
      true if the execution updates the schema.
    • toString

      public String toString()