Sessions

SQL Server Command Timeout – Application Timeout – Extended Event Attention

SQL Server Command Timeout – Application Timeout – Extended Event Attention

6 months ago
When you use ODBC or SqlClient to access data from SQL Server, by default the query will be cancelled if there is no response from the server within a certain period of time (30 seconds by default). ODBC or SqlClient will start a timer after sending the query to SQL Server and if there are […]
Data Compression in SQL Server – Pros and Cons

Data Compression in SQL Server – Pros and Cons

6 months ago
SQL Server supports row and page compression on tables, indexes and partitions. This can lead to reduced I/O and better performance. However, it can also result in additional CPU usage in some cases, outweighing the benefits of data compression. SQL Server query optimizer does not cost the overhead of expanding the compressed data, which can […]
Resource Governor in SQL Server – Workload Throttling

Resource Governor in SQL Server – Workload Throttling

6 months ago
Resource Governor in SQL Server provides CPU, Memory and I/O throttling. In SQL Server 2014 and earlier, CPU throttling works only for similar kind of workloads and not for mixed workloads, where high importance workload group gets 9 slices of CPU, medium importance gets 3 slices and low 1 slice. In SQL Server 2016, CPU […]
Understanding ASYNC_NETWORK_IO Waits in SQL Server

Understanding ASYNC_NETWORK_IO Waits in SQL Server

6 months ago
In SQL Server, ASYNC_NETWORK_IO wait time can be high due to slow network, like when the database is in the cloud and the application is on premise. Furthermore, it can be slow when CPU utilization is high in the application server preventing timely fetching of all rows or, in most cases, when the application reads […]
Cardinality Estimation – Table Variable Vs Temporary Table in SQL Server

Cardinality Estimation – Table Variable Vs Temporary Table in SQL Server

6 months ago
SQL Server creates and maintains statistics for temporary tables, which lead to better cardinality estimation and optimal execution plan generation. Table variables have no statistics, which can result in poor cardinality estimation and non-optimal execution plan creation. When you add query hint option (recompile) when using table variable, SQL Server can use heuristics based estimates, […]
Parallel Insert Into – Table Variable Vs Temporary Table in SQL Server

Parallel Insert Into – Table Variable Vs Temporary Table in SQL Server

6 months ago
In SQL Server, for insert into select statements, when the target for insert into is temporary table, the select statement can execute in parallel. When the target is table variable, SQL Server will not execute the select statement in parallel, which can lead to poor performance. The below video demonstrates this with hands-on example. SQLTest […]
Filtered Statistics in SQL Server

Filtered Statistics in SQL Server

6 months ago
In SQL Server, Filtered Statistics can improve cardinality estimation, i.e. when joining lookup table, or while joining fact table and dimension table. For this reason, SQL Server supports the creation of up to 30,000 statistics on non-indexed columns. Better estimation with filtered statistics can lead to faster query execution against star schema based data warehouses, […]
Temp Table Caching in SQL Server

Temp Table Caching in SQL Server

6 months ago
SQL Server caches temporary objects (temporary tables and table variables), that are created in a stored procedure. Temporary objects that are created either in dynamic SQL statement or by using sp_executesql are not cached. Temp table caching can lead to better performance by reducing Tempdb Allocation Contention. SQL Server will not cache temporary table in […]
In-Memory OLTP Memory Optimized Table Variables Vs Disk Based Table Variable in SQL Server

In-Memory OLTP Memory Optimized Table Variables Vs Disk Based Table Variable in SQL Server

6 months ago
Starting SQL Server 2014, it is possible to use memory optimized table variables. These are table variables declared using a table type which is memory optimized. Memory optimized table variables have no disk footprint and don’t have PAGELATCH (like PAGELATCH_EX and PAGELATCH_SH) or LOGBUFFER waits, hence they result in faster performance compared to traditional disk […]
Tempdb Allocation Contention in SQL Server

Tempdb Allocation Contention in SQL Server

6 months ago
In SQL Server, the concurrent creation of temporary objects (temporary tables and table variables) from many sessions can lead to tempdb allocation contention. This contention occurs on PFS and SGAM pages in tempdb (like PAGELATCH_EX and PAGELATCH_SH waits). It is recommended to create additional data files for tempdb and implement trace flag 1118 to reduce […]
PAGELATCH Waits with Update Statements in SQL Server – PAGELATCH_EX and PAGELATCH_SH

PAGELATCH Waits with Update Statements in SQL Server – PAGELATCH_EX and PAGELATCH_SH

6 months ago
In SQL Server, concurrent writes or read / write to the same page can lead to PAGELATCH (like PAGELATCH_EX and PAGELATCH_SH) waits or what is knowns as PAGELATCH contention. One common use case is when invoice numbers are stored in a table. If the row is narrow, then many rows can fit in the 8KB […]
Extended Event Query Post Execution Showplan in SQL Server

Extended Event Query Post Execution Showplan in SQL Server

6 months ago
Query Post Execution Showplan event is a very useful event to find problematic queries and execution plans based on CPU usage or duration while analyzing performance issues. It can increase the execution time of all queries by a fraction of a millisecond, irrespective of the total query cost, which means, the overhead of query_post_execution_showplan event […]