Expand description
Execution limits and safeguards
This module defines limits to prevent infinite loops, stack overflow, and runaway queries. These limits follow industry best practices established by SQLite and other production databases.
§Design Philosophy
These limits serve multiple purposes:
- Safety: Prevent crashes from stack overflow or infinite recursion
- Performance: Kill runaway queries that would hang the system
- Debugging: Provide clear error messages when limits are exceeded
- Compatibility: Match SQLite’s limit philosophy for consistency
§Limit Values
Default values are chosen conservatively to allow legitimate queries while catching pathological cases. They can be adjusted based on real-world usage patterns.
Constants§
- MAX_
COMPOUND_ SELECT - Maximum number of compound SELECT terms
- MAX_
EXPRESSION_ DEPTH - Maximum depth of expression tree evaluation (subqueries, nested expressions)
- MAX_
LOOP_ ITERATIONS - Maximum number of iterations in a single loop (e.g., WHERE filtering)
- MAX_
MEMORY_ BYTES - MAX_
QUERY_ EXECUTION_ SECONDS - Maximum execution time for a single query (in seconds)
- MAX_
RECURSIVE_ CTE_ ITERATIONS - Maximum number of iterations for recursive CTEs
- MAX_
ROWS_ PROCESSED - Maximum number of rows to process in a single query execution
- MAX_
TABLES_ IN_ JOIN - Maximum number of tables in a single join operation
- MEMORY_
WARNING_ BYTES