top of page
Search
Kunal Ranpura
Jul 1, 20222 min read
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...
32 views0 comments
Kunal Ranpura
Jun 24, 20222 min read
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...
8 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
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...
22 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
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,...
53 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
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],...
15 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
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...
8 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
-- 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...
7 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
-- 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],...
10 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
-- 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...
8 views0 comments
Kunal Ranpura
Aug 12, 20191 min read
-- 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,...
8 views0 comments
Kunal Ranpura
Jul 30, 20191 min read
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...
19 views0 comments
Kunal Ranpura
Jul 30, 20191 min read
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...
12 views0 comments
Kunal Ranpura
Jul 29, 20191 min read
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)...
45 views0 comments
Kunal Ranpura
Jul 29, 20192 min read
SQL Server Wait Types Explained
-- Common Significant Wait types with BOL explanations -- *** Network Related Waits *** -- ASYNC_NETWORK_IO Occurs on network writes...
12 views0 comments
Kunal Ranpura
Jul 29, 20191 min read
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...
20 views0 comments
Kunal Ranpura
Jul 29, 20191 min read
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...
12 views0 comments
Kunal Ranpura
Jul 29, 20191 min read
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...
9 views0 comments
Kunal Ranpura
Jul 29, 20192 min read
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);...
14 views0 comments
Kunal Ranpura
Jul 29, 20193 min read
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 (...
11 views0 comments
Kunal Ranpura
Jul 28, 20192 min read
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...
7 views0 comments
bottom of page