Overview
What Performance Mode Disables
Enabling Performance Mode
Using config object
Using module-level functions
Using convenience imports
Setting performance mode automatically sets the execution engine to
chdb. You do not need to call config.use_chdb() separately.When to Use Performance Mode
Use performance mode when:- Processing large datasets (hundreds of thousands to millions of rows)
- Running aggregation-heavy workloads (groupby, sum, mean, count)
- Row order does not matter (e.g., aggregated results, reports, dashboards)
- You want maximum SQL throughput and minimal overhead
- Memory usage is a concern (parallel Parquet reading, no intermediate DataFrames)
- You need exact pandas behavior (row order, MultiIndex, dtypes)
- You rely on
first()/last()returning the true first/last row - You use
shift(),diff(),cumsum()that depend on row order - You’re writing tests that compare DataStore output with pandas
Behavior Differences
Row Order
In performance mode, row order is not guaranteed for any operation. This includes:- Filter results
- GroupBy aggregation results
head()/tail()without explicitsort_values()first()/last()aggregations
sort_values():
GroupBy Results
Aggregation
Single-SQL Execution
In performance mode,ColumnExpr groupby aggregation (e.g., ds[condition].groupby('col')['val'].sum()) is executed as a single SQL query instead of the two-step process used in pandas mode:
Comparison with Execution Engine
Performance mode (compat_mode) and execution engine (execution_engine) are independent configuration axes:
Setting
compat_mode='performance' automatically sets execution_engine='chdb', since performance mode is designed for SQL execution.
Testing with Performance Mode
When writing tests for performance mode, results may differ from pandas in row order and structural format. Use these strategies:Sort-then-compare (aggregations, filters)
Value-range check (first/last)
Schema-and-count (LIMIT without ORDER BY)
Best Practices
- Enable early in your script
- Add explicit sorting when order matters
- Use for batch/ETL workloads
- Switch modes within a session
Related Documentation
- Execution Engine — Engine selection (auto/chdb/pandas)
- Performance Guide — General optimization tips
- Key Differences from pandas — Behavioral differences