Skip to main content

Module profiling

Module profiling 

Source
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 logging
  • VIBESQL_DEBUG=scan - Enable only scan path logging
  • VIBESQL_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 costs
  • SUBQUERY_TRANSFORM_VERBOSE - Subquery-to-join transformations
  • TABLE_ELIM_VERBOSE - Table elimination decisions
  • SCAN_PATH_VERBOSE - Scan path selection (index vs table scan)
  • INDEX_SELECT_DEBUG - Index selection decisions

§Phase Timing Flags

  • DELETE_PROFILE - Delete operation phase timing
  • JOIN_PROFILE - Join execution phase timing
  • RANGE_SCAN_PROFILE - Range scan phase timing

Structs§

ProfileTimer
A profiling timer that logs elapsed time when dropped

Enums§

DebugCategory
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