v.22.8Improvement

Add ProfileEvents Counters for Query Complexity Limitations

Add counters (ProfileEvents) for cases when query complexity limitation has been set and has reached (a separate counter for overflow_mode = break and throw). For example, if you have set up max_rows_to_read with read_overflow_mode = 'break', looking at the value of OverflowBreak counter will allow distinguishing incomplete results. #40205 (Alexey Milovidov).
Added separate ProfileEvents counters to track when query complexity limits are reached, distinguishing between overflow_mode set to break and throw.

Why it matters

This feature helps users monitor and understand when queries hit configured complexity limits such as max_rows_to_read during execution. By providing distinct counters for different overflow modes, it allows users to detect incomplete results (in case of break) or errors (in case of throw), improving observability and troubleshooting.

How to use it

Configure query complexity limits like max_rows_to_read along with the read_overflow_mode setting (e.g., break or throw). Then, monitor the new ProfileEvents counters OverflowBreak and the corresponding counter for throw to determine when limits are reached and how queries behave.