Expand description
Performance profiling and debug utilities for understanding bottlenecks
This module provides profiling infrastructure that integrates with the
structured debug output system. When VIBESQL_DEBUG_FORMAT=json, profiling
output is emitted as JSON for machine parsing.
§Environment Variables
§Umbrella Debug Flag
VIBESQL_DEBUG provides unified control over all semantic debug logging:
VIBESQL_DEBUG=1- Enable all semantic logging (optimizer decisions)VIBESQL_DEBUG=optimizer- Enable only optimizer-related loggingVIBESQL_DEBUG=scan- Enable only scan path loggingVIBESQL_DEBUG=dml- Enable only DML-related logging
§Individual Flags (for fine-grained control)
These flags work independently or are auto-enabled by VIBESQL_DEBUG:
JOIN_REORDER_VERBOSE- Join reorder decisions and costsSUBQUERY_TRANSFORM_VERBOSE- Subquery-to-join transformationsTABLE_ELIM_VERBOSE- Table elimination decisionsSCAN_PATH_VERBOSE- Scan path selection (index vs table scan)INDEX_SELECT_DEBUG- Index selection decisions
§Phase Timing Flags
DELETE_PROFILE- Delete operation phase timingJOIN_PROFILE- Join execution phase timingRANGE_SCAN_PROFILE- Range scan phase timing
Structs§
- Profile
Timer - A profiling timer that logs elapsed time when dropped
Enums§
- Debug
Category - Debug categories enabled via VIBESQL_DEBUG
Functions§
- debug_
category - Get the current debug category
- init
- Initialize profiling based on environment variable. Also initializes the debug output format.
- is_
debug_ enabled - Check if a specific debug category is enabled
- is_
enabled - Check if profiling is enabled
- is_
scan_ debug_ enabled - Check if scan path debug logging is enabled Returns true if VIBESQL_DEBUG=1, VIBESQL_DEBUG=scan, or SCAN_PATH_VERBOSE=1