top of page

Search

Automatic Query Tunning in SQL Server
The Query Store provides database administrators with in-depth insights on query plans and performance metrics. By default, execution...
Kunal Ranpura
Jul 1, 20222 min read
36 views
0 comments


Skip Target - Temp DB Proportional fill algorithm
Understanding the SQL Server Proportional fill algorithm When creating a database, SQL Server maps this database with minimum two...
Kunal Ranpura
Jun 24, 20222 min read
12 views
0 comments
SQL Server Find what Objects are using space in buffer cache
-- Breaks down buffers used by current database by object (table, index) in the buffer cache SELECT OBJECT_NAME(p.[object_id]) AS...
Kunal Ranpura
Aug 12, 20191 min read
22 views
0 comments
Find your SQL Server Index writes vs reads
-- Possible Bad NC Indexes (writes > reads) SELECT OBJECT_NAME(s.[object_id]) AS [Table Name], i.name AS [Index Name], i.index_id,...
Kunal Ranpura
Aug 12, 20191 min read
55 views
0 comments
Lists the top SQL Server statements by average input/output usage for the current database
SELECT TOP(50) OBJECT_NAME(qt.objectid) AS [SP Name], (qs.total_logical_reads + qs.total_logical_writes) /qs.execution_count AS [Avg IO],...
Kunal Ranpura
Aug 12, 20191 min read
15 views
0 comments
Top Cached SPs By Total Logical Writes.
-- Logical writes relate to both memory and disk I/O pressure SELECT TOP(25) p.name AS [SP Name], qs.total_logical_writes AS...
Kunal Ranpura
Aug 12, 20191 min read
9 views
0 comments
-- Top Cached SPs By Total Physical Reads. Physical reads relate to disk I/O pressure
SELECT TOP(25) p.name AS [SP Name],qs.total_physical_reads AS [TotalPhysicalReads], qs.total_physical_reads/qs.execution_count AS...
Kunal Ranpura
Aug 12, 20191 min read
7 views
0 comments
-- Top Cached SQL Server Stored Procedure By Total Logical Reads.
-- Top Cached SPs By Total Logical Reads. Logical reads relate to memory pressure SELECT TOP(25) p.name AS [SP Name],...
Kunal Ranpura
Aug 12, 20191 min read
10 views
0 comments
-- Top Cached SPs By Total Worker time. Worker time relates to CPU cost
SELECT TOP(25) p.name AS [SP Name], qs.total_worker_time AS [TotalWorkerTime], qs.total_worker_time/qs.execution_count AS...
Kunal Ranpura
Aug 12, 20191 min read
8 views
0 comments
-- Top Cached SPs By Avg Elapsed Time
SELECT TOP(25) p.name AS [SP Name], qs.total_elapsed_time/qs.execution_count AS [avg_elapsed_time], qs.total_elapsed_time,...
Kunal Ranpura
Aug 12, 20191 min read
8 views
0 comments
Top Cached Stored Procedure by Execution Count
-- Top Cached SPs By Execution Count (SQL 2008) SELECT TOP(250) p.name AS [SP Name], qs.execution_count, --ISNULL(qs.execution_count/DATE...
Kunal Ranpura
Jul 30, 20191 min read
19 views
0 comments
Get Average Task Counts for SQL Server
-- Get Average Task Counts (run multiple times) SELECT AVG(current_tasks_count) AS [Avg Task Count], AVG(runnable_tasks_count) AS [Avg...
Kunal Ranpura
Jul 30, 20191 min read
12 views
0 comments
Signal Waits in SQL Server
-- Signal Waits for instance SELECT CAST(100.0 * SUM(signal_wait_time_ms) / SUM (wait_time_ms) AS NUMERIC(20,2)) AS [%signal (cpu)...
Kunal Ranpura
Jul 29, 20191 min read
45 views
0 comments
SQL Server Wait Types Explained
-- Common Significant Wait types with BOL explanations -- *** Network Related Waits *** -- ASYNC_NETWORK_IO Occurs on network writes...
Kunal Ranpura
Jul 29, 20192 min read
12 views
0 comments
SQL Server Get total buffer usage by database for current instance
-- Get total buffer usage by database for current instance SELECT DB_NAME(database_id) AS [Database Name], COUNT(*) * 8/1024.0 AS [Cached...
Kunal Ranpura
Jul 29, 20191 min read
20 views
0 comments
SQL Server CPU MAXDOP Setting
Maxdop - 1, means no parallelism Maxdop - 0 (Default), Means SQL Server can aggressively use all the available processor to execute the...
Kunal Ranpura
Jul 29, 20191 min read
12 views
0 comments
Script to find SQL Server Data and Log file Auto Growth Event
--Script to find autogrowth event from the default trace. DECLARE @filename NVARCHAR(1000); DECLARE @bc INT; DECLARE @ec INT; DECLARE...
Kunal Ranpura
Jul 29, 20191 min read
9 views
0 comments
Script to find No. of Virtual Log File Count (VLFs)
--Script to find number of VLF. SET NOCOUNT ON; /* declare variables required */ DECLARE @DatabaseId INT; DECLARE @TSQL varchar(MAX);...
Kunal Ranpura
Jul 29, 20192 min read
14 views
0 comments
Analysis for enabling compression at object level
--Collect all index stats if object_id('index_estimates') is not null drop table index_estimates go create table index_estimates (...
Kunal Ranpura
Jul 29, 20193 min read
11 views
0 comments
Script to Defrag Index Fragmented more than 10% in SQL 2000
/*Perform a 'USE <database name>' to select the database in which to run the script.*/ -- Declare variables SET NOCOUNT ON; DECLARE...
Kunal Ranpura
Jul 28, 20192 min read
8 views
0 comments
bottom of page