top of page

Search
Find Missing Indexes using Query Store
SELECT SUM (qrs.count_executions) * AVG (qrs.avg_logical_io_reads) as est_logical_reads, SUM (qrs.count_executions) AS...

Kunal Ranpura
May 29, 20251 min read
SQL Server Find Missing Index using Query Store
--Query to find missing index from query store, from last 30days usage SELECT TOP 20 qsq.query_id, SUM(qrs.count_executions) *...

Kunal Ranpura
Mar 31, 20251 min read
SQL Server Profiler Trace
--Import multiple trace file in sql Table. --All the rollover files will be automatically imported --provide number tracefile to capture...

Kunal Ranpura
Feb 19, 20241 min read
SQL Replication Mark Transaction as commit
--SQL Server Database log full due to replication, you can run the following command to mark all ---the replication transaction is done,...

Kunal Ranpura
Feb 5, 20241 min read
Disable Change Data Capture for multiple tables
--disable cdc master --Table Contains list of all the tables where cdc needs to be disabled - [dba].dbo.replication_cdc_table --execute...

Kunal Ranpura
Dec 21, 20231 min read
Find All Primary Key in SQL Server
select schema_name(tab.schema_id) as [schema_name], pk.[name] as pk_name, substring(column_names, 1, len(column_names)-1) as [columns],...

Kunal Ranpura
Apr 14, 20231 min read
Identify slow running queries in snowflake
select distinct count(query_id) as total_query --,QUERY_TEXT --,DATABASE_NAME --,SCHEMA_NAME --,QUERY_TYPE --,USER_NAME --,ROLE_NAME...

Kunal Ranpura
Mar 8, 20231 min read
Script to find role assigned to the user in snowflake
select GRANTEE_NAME AS "USERNAME", ROLE from SNOWFLAKE.ACCOUNT_USAGE.GRANTS_TO_USERS where DELETED_ON is null and Role = 'ROLENAME' and...

Kunal Ranpura
Mar 8, 20231 min read
Script Find long running Queries in Snowflake
select Total_Elapsed_Time/60000 Total_Time_MINS, Database_name, schema_name, User_name, Role_name, Warehouse_name, Warehouse_size,...

Kunal Ranpura
Mar 8, 20231 min read
Script to Clone Table in Snowflake
--clone table in snowflake create table orders_clone clone orders;

Kunal Ranpura
Mar 8, 20231 min read
Find Snowflake task run history
--get task history: select * from table(information_schema.task_history( scheduled_time_range_start=>dateadd('hour',-1,current_timestamp(...

Kunal Ranpura
Mar 8, 20231 min read
Snowflake Create Sequence - it uses two cursors one for schema name and another for table name
SET ANSI_NULLS ON; SET ARITHABORT ON; SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; Declare @SEQUENCE_SCHEMA varchar(max); Declare...

Kunal Ranpura
Mar 8, 20231 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...

Kunal Ranpura
Jul 1, 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...

Kunal Ranpura
Jun 24, 20222 min read


Cannot connect to RDS Database instance
connecting to RDS instance SQL Server

Kunal Ranpura
Jun 1, 20221 min read
Snowflake Administration
Script to clone tables in snowflake Run this script in sql server to generated the output command: snowflake table clone script. SET...

Kunal Ranpura
Apr 7, 20221 min read
SQL Server find Database User Permission
--Execute the following script against the User Database where you need to find DB User permission. DECLARE @sql VARCHAR(2048) ,@sort INT...

Kunal Ranpura
Jan 28, 20203 min read
SQL Server Snapshot Isolation
--Script to verify snapshot isolation enabled SELECT name , s.snapshot_isolation_state , snapshot_isolation_state_desc ,...

Kunal Ranpura
Jan 15, 20201 min read
SQL Server Script to Setup Change data capture
Below is the script to enable change data capture to customer table. USE DB_name GO -- Enable CDC on the database. if ( not exists (...

Kunal Ranpura
Jan 13, 20201 min read
SQL Server List all Partitioned tables
Find list of all the partitioned tables in sql server. use userdb_name go select distinct t.name from sys.partitions p inner join...

Kunal Ranpura
Jan 13, 20201 min read
bottom of page





