explain() Method
The explain() method shows the execution plan for a DataStore query, helping you understand what operations will be performed and what SQL will be generated.
Basic Usage
Syntax
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
verbose | bool | False | Show additional metadata |
Output Format
Standard Output
Icons Legend
| Icon | Meaning |
|---|---|
| 📊 | Data source |
| 🚀 | chDB (SQL) operation |
| 🐼 | pandas operation |
Verbose Output
Verbose mode shows additional details for each operation, including the full SQL query with internal row-order tracking mechanisms.
Three Execution Phases
The explain output shows operations in three phases:
Phase 1: SQL Query Building (Lazy)
Operations that compile to SQL:
Phase 2: Execution Point
When a trigger occurs:
Phase 3: DataFrame Operations
Operations after execution:
Understanding the Plan
Source Information
file()- ClickHouse file() table function'CSVWithNames'- File format with header
Other source types:
Filter Operations
Shows the WHERE clause that will be applied.
GroupBy and Aggregate
Shows GROUP BY columns and aggregation functions.
Sort Operations
Shows ORDER BY clause.
Limit Operations
Shows LIMIT and OFFSET.
Engine Information
When using verbose mode, you can see which engine will be used:
Pushdown
- Yes: Operation will be executed at the data source (SQL)
- No: Operation requires pandas execution
Examples
Simple Query
Complex Aggregation
Mixed SQL and pandas
When operations cannot be fully pushed to SQL, the plan shows multiple segments: