UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Graphset
    • Schema
    • Property
    • Constraints
    • Insert
    • Overwrite or Insert
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • All Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Table Functions
    • Null Functions
    • Type Conversion Functions
  • Operators
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
    • Cache
    • Overview
    • Managing HDC Graphs
    • HDC Graph Queries
    • Process
    • Job
    • Execution Plan
    • Alias
    • Filter
    • Values and Types
    • Data Flow in Queries
    • Comments
    • Reserved Words
  • Access Control
  1. Docs
  2. /
  3. UQL
  4. /
  5. UQL Execution

Execution Plan

Overview

When a UQL query is submitted to Ultipa, it first undergoes parsing to validate its syntax. Once parsed, the query is passed through an optimization phase where Ultipa evaluates potential execution strategies based on the current state of the database.

Ultipa's query optimizer selects the most efficient execution plan by considering factors like data distribution, indexing, and potential bottlenecks. This execution plan outlines the optimal sequence of operations, minimizing resource consumption and improving query performance.


Lifecycle of a UQL query

To examine the execution plan of a query, prefix it with either EXPLAIN or PROFILE.

EXPLAIN

The EXPLAIN generates the execution plan for a query without actually running it. It provides a detailed tree of execution operators that outlines the steps the query engine will take to retrieve the desired results.

UQL
explain
find().nodes({@account}) as n
return n.name limit 10

The output is a structured representation of the execution plan, often referred to as _explain.

_explain
Exchange{1}{distribution:distribution_type:SINGLETON,partition_ids:[1],gap_type:ROOT}  ::  n.name:ANY
->    Return(ROOT){expr:[n.name]  row_type:n.name:ANY}
        ->    Return(ROOT){expr:[n.name]  row_type:n.name:ANY}
                ->    Limit{limit:10,phase:DEFAULT,row_type:n.name:ANY}
                        ->    NodeSearch{alias:n,access_method:{condition:@account,index_name:schema,query_type:SK_SCHEMA_SCAN},row_type:n:NODE{name:STRING}}

PROFILE

PROFILE runs the query and returns both the query results and a profile_info table. This table includes details such as the execution operators used, the number of rows each operator produces, and the time cost of each step.

UQL
profile
find().nodes({@account}) as n
return n.name limit 10

Sample profile_info output:

levelop_nameop_idtime_costrows
--1RETURN117μs121
----2RETURN28μs121
------3LIMIT_SKIP31μs121
--------4NODE_SCAN4440μs121