Relative Content

Tag Archive for sql-serverperformancequery-optimizationdatabase-performance

Performance issues with recursive SQL Server stored procedure for hierarchical data

I have a stored procedure GetCombinedRequestInfosByEmail that retrieves hierarchical data for employees. The procedure performs well for lower-level employees but takes around 55 seconds to execute for higher-level employees (e.g., CEO with 30,000 employees). For managers with fewer employees (10-7), it executes in milliseconds.

Performance Issues with Recursive SQL Stored Procedure for Hierarchical Data

I have a stored procedure GetCombinedRequestInfosByEmail that retrieves hierarchical data for employees. The procedure performs well for lower-level employees but takes around 55 seconds to execute for higher-level employees (e.g., CEO with 30,000 employees). For managers with fewer employees (10-7), it executes in milliseconds. I am using another stored procedure GetRequestInfosByUser within this procedure, which dynamically constructs and executes a SQL query.
My current version of stored procedure: