Skip to main content
DataStore can execute operations using different backends. This guide explains how to configure and optimize engine selection.

Available Engines

Setting the Engine

Global Configuration

Checking Current Engine


Auto Mode

In auto mode (default), DataStore selects the optimal engine for each operation:

Operations Executed in chDB

  • SQL-compatible filtering (filter(), where())
  • Column selection (select())
  • Sorting (sort(), orderby())
  • Grouping and aggregation (groupby().agg())
  • Joins (join(), merge())
  • Distinct (distinct(), drop_duplicates())
  • Limiting (limit(), head(), tail())

Operations Executed in pandas

  • Custom apply functions (apply(custom_func))
  • Complex pivot tables with custom aggregations
  • Operations not expressible in SQL
  • When input is already a pandas DataFrame

Example


chDB Mode

Force all operations through ClickHouse SQL:

When to Use

  • Processing large datasets (millions of rows)
  • Heavy aggregation workloads
  • When you want maximum SQL optimization
  • Consistent behavior across all operations

Performance Characteristics

Limitations

  • Custom Python functions may not be supported
  • Some pandas-specific features require conversion

pandas Mode

Force all operations through pandas:

When to Use

  • Compatibility testing with pandas
  • Using pandas-specific features
  • Debugging pandas-related issues
  • When data is already in pandas format

Performance Characteristics


Cross-DataStore Engine

Configure the engine for operations that combine columns from different DataStores:

Example


Engine Selection Logic

Auto Mode Decision Tree

Function-Level Override

Some functions can have their engine explicitly configured:
See Function Config for details.

Performance Comparison

Benchmark results on 10M rows: Key insights:
  • chDB excels at aggregations and complex pipelines
  • pandas is slightly faster for simple single operations
  • Use auto mode to get the best of both

Best Practices

  1. Start with Auto Mode

  1. Profile Before Forcing

  1. Force Engine for Specific Workloads

  1. Use explain() to Understand Execution


Troubleshooting

Issue: Operation slower than expected

Issue: Unsupported operation in chdb mode

Issue: Memory issues with large data

Performance ModeIf you are running heavy aggregation workloads and don’t need exact pandas output compatibility (row order, MultiIndex, dtype corrections), consider using Performance Mode. It automatically sets the engine to chdb and removes all pandas compatibility overhead.
Last modified on July 2, 2026