CSharpDB.Execution
1.1.0
dotnet add package CSharpDB.Execution --version 1.1.0
NuGet\Install-Package CSharpDB.Execution -Version 1.1.0
<PackageReference Include="CSharpDB.Execution" Version="1.1.0" />
<PackageVersion Include="CSharpDB.Execution" Version="1.1.0" />
<PackageReference Include="CSharpDB.Execution" />
paket add CSharpDB.Execution --version 1.1.0
#r "nuget: CSharpDB.Execution, 1.1.0"
#:package CSharpDB.Execution@1.1.0
#addin nuget:?package=CSharpDB.Execution&version=1.1.0
#tool nuget:?package=CSharpDB.Execution&version=1.1.0
CSharpDB.Execution
Query planner, operator tree, and expression evaluator for the CSharpDB embedded database engine.
Overview
CSharpDB.Execution transforms parsed SQL (AST from CSharpDB.Sql) into executable query plans. It implements the classic iterator model with physical operators for scans, joins, aggregation, sorting, filtering, and projection. Expression evaluation is handled by both an interpreter (for one-off use) and a compiler (for hot-path evaluation with column binding at compile time).
Key Components
Query Planner
- Translates AST statements into physical operator trees
- Dispatches to type-specific handlers for all DDL and DML statements
- System catalog virtual tables:
system_tables,system_columns,system_indexes,system_views,system_triggers - Compiled expression cache (up to 4096 entries) for repeated queries
- Trigger body caching with schema-sensitive invalidation
- Sync point-lookup fast path for
SELECT ... WHERE pk = value
Operator Tree (Iterator Model)
IOperatorinterface:OpenAsync,MoveNextAsync,Current,OutputSchemaTableScanOperatorwith pre-decode filtering, projection pushdown, and row count estimation- Join operators, filter, sort, aggregate, limit/offset, projection, and more
- Internal optimization interfaces:
IPreDecodeFilterSupport,IProjectionPushdownTarget,IMaterializedRowsProvider
Expression Evaluation
ExpressionEvaluator- Static interpreter for simple/infrequent evaluationsExpressionCompiler- Compiles expression ASTs intoFunc<DbValue[], DbValue>delegates with column indices bound at compile time, eliminating per-row schema lookups
Query Result
- Wraps operator output (SELECT) or rows-affected counts (DML/DDL)
- Sync fast-path for point lookups via
FromSyncLookup ToListAsyncfor materializing full result sets
Usage
using CSharpDB.Execution;
using CSharpDB.Sql;
// Parse SQL
var statements = Parser.Parse("SELECT name, age FROM users WHERE age > 21");
// Plan and execute (typically called through CSharpDB.Engine)
var planner = new QueryPlanner(storageContext);
var result = await planner.ExecuteAsync(statements[0]);
// Iterate results
while (await result.MoveNextAsync())
{
DbValue[] row = result.Current;
Console.WriteLine($"{row[0].AsText}, {row[1].AsInteger}");
}
Installation
dotnet add package CSharpDB.Execution
Dependencies
CSharpDB.Core- shared type systemCSharpDB.Sql- SQL parser and ASTCSharpDB.Storage- B+tree storage engine
Related Packages
| Package | Description |
|---|---|
| CSharpDB.Engine | Embedded database engine that wraps this execution layer |
| CSharpDB.Sql | SQL parser producing the AST this package consumes |
| CSharpDB.Storage | Storage layer for physical I/O |
License
MIT - see LICENSE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CSharpDB.Core (>= 1.1.0)
- CSharpDB.Sql (>= 1.1.0)
- CSharpDB.Storage (>= 1.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CSharpDB.Execution:
| Package | Downloads |
|---|---|
|
CSharpDB.Engine
Lightweight embedded SQL database engine for .NET. Single-file storage, WAL durability, concurrent readers, and a typed Collection<T> NoSQL API. |
GitHub repositories
This package is not used by any popular GitHub repositories.