Overview
The Query Editor provides a powerful interface for writing SQL queries directly against your data. Built on DuckDB, it supports standard SQL syntax with extensions for analytical workloads.Editor Interface
The query editor is implemented inQueryEditor.tsx and provides:
- Syntax highlighting for SQL
- Multi-line query support
- Keyboard shortcuts for execution
- Command queue for batch operations
- Real-time error reporting
Basic Usage
Writing Queries
Simple Selection
Aggregations
Joins
Window Functions
Command Queue
When multiple commands are queued, the editor shows progress:Queue Visualization
/home/daytona/workspace/source/src/components/QueryEditor.tsx:112
Keyboard Shortcuts
Execute Query
Execute Query
Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac)Executes the current query immediately:
Multi-line Editing
Multi-line Editing
Use Enter to create new lines without executing.The textarea automatically resizes:
Error Handling
The editor displays errors inline with helpful messages:Common Errors
DuckDB Features
Meridian’s query editor supports DuckDB’s powerful analytical features:JSON Functions
Date/Time Functions
String Functions
Regular Expressions
Query Execution Flow
Queries are executed through a multi-step process:Advanced Features
CTEs (Common Table Expressions)
Subqueries
CASE Statements
Performance Tips
Use LIMIT for Exploration
Use LIMIT for Exploration
When exploring large tables, always use LIMIT:This prevents loading millions of rows into memory.
Filter Early
Filter Early
Apply WHERE clauses before joins and aggregations:
Use Appropriate Aggregations
Use Appropriate Aggregations
Choose the right aggregation function:
Leverage Column Pruning
Leverage Column Pruning
Only select columns you need:
Query Patterns
Top N per Group
Running Totals
Year-over-Year Comparison
Integration with Other Features
The Query Editor integrates seamlessly with other Meridian features:With AI Agents
With Visualizations
API Reference
The Query Editor uses the DuckDB query API:/home/daytona/workspace/source/src/routes/api/duckdb/query.ts).
Next Steps
AI Agents
Let AI generate queries for you automatically
Chart Visualization
Visualize your query results with charts