top of page

Search
Script Rebuild Index Depending on Fragmentation
The below script rebuild all the indexes that are fragmented higher than 30%. Reorg indexes that are fragmented between 10%-30% -- Ensure...

Kunal Ranpura
Jul 28, 20192 min read
24 views
0 comments
Buffer Pool Extension
--Buffer Pool Extension Alter server configuration set buffer pool extension on (filename ='D:\extrabuffer.bpe', size = 32GB) GO

Kunal Ranpura
Jul 28, 20191 min read
8 views
0 comments
Find Top 50 SQL statements and SP with highest workertime and execution count.
SELECT TOP (50) sp.database_id, dbname= DB_NAME (qt.dbid), so.name AS StoredProcName, sp.total_worker_time, sp.execution_count AS...

Kunal Ranpura
Jul 28, 20191 min read
16 views
0 comments
Query to find Storedprocedure with the highest total workertime in SQL Server
SELECT TOP (10) sp.database_id, so.name AS StoredProcName, sp.total_worker_time, sp.execution_count, sp.total_logical_reads,...

Kunal Ranpura
Jul 28, 20191 min read
4 views
0 comments
SQL Server object with most latch contention
SELECT TOP (5) a.database_id, so.object_id, so.name AS TableName, a.page_latch_wait_count , a.page_latch_wait_in_ms,...

Kunal Ranpura
Jul 28, 20191 min read
5 views
0 comments
Table Used most in SQL Server
SELECT TOP (5) b.name AS TableName, a.database_id, a.singleton_lookup_count, a.range_scan_count FROM sys.dm_db_index_operational_stats(...

Kunal Ranpura
Jul 28, 20191 min read
13 views
0 comments
Find Storage Latency in SQL Server
SELECT [ReadLatency] = CASE WHEN [num_of_reads] = 0 THEN 0 ELSE ([io_stall_read_ms] / [num_of_reads]) END, [WriteLatency] = CASE WHEN...

Kunal Ranpura
Jul 28, 20191 min read
22 views
0 comments
SQL Server Page Split/Sec using DMV
--Page Split/Sec using DMV SELECT ms_ticks FROM sys.dm_os_sys_info; Select * from sys.dm_os_performance_counters where object_name =...

Kunal Ranpura
Jul 28, 20191 min read
6 views
0 comments
Find who uses the most query memory grant in SQL Server
---Find who uses the most query memory grant: SELECT mg.granted_memory_kb, mg.session_id, t.text, qp.query_plan FROM...

Kunal Ranpura
Jul 28, 20191 min read
15 views
0 comments
SQL Server Average Stall Per IO
-- Calculates average stalls per read, per write, and per total input/output for each database file. SELECT DB_NAME(fs.database_id) AS...

Kunal Ranpura
Jul 28, 20191 min read
34 views
0 comments
Query to find page life expectency in SQL Server
SELECT @@servername AS INSTANCE ,[object_name] ,[counter_name] , UPTIME_MIN = CASE WHEN[counter_name]= 'Page life expectancy' THEN...

Kunal Ranpura
Jul 28, 20191 min read
176 views
0 comments
bottom of page