Skip to content

Instantly share code, notes, and snippets.

View alivarzeshi's full-sized avatar

Ali varzeshi alivarzeshi

View GitHub Profile
@alivarzeshi
alivarzeshi / Alivarzeshi
Last active October 12, 2024 16:00
Optimizing WordPress performance
‎‎​
@alivarzeshi
alivarzeshi / Main Folder Security.sql
Last active October 12, 2024 16:36
Main Folder Security
DECLARE @IsPrimary INT;
DECLARE @JobName NVARCHAR(128);
-- Check if the current node is the primary replica
SELECT @IsPrimary = CASE
WHEN role_desc = 'PRIMARY' THEN 1
ELSE 0
END
FROM sys.dm_hadr_availability_replica_states AS ars
JOIN sys.availability_replicas AS ar
@alivarzeshi
alivarzeshi / gist:5d642bde069be93136fab4601945dda6
Last active July 31, 2021 04:46
SQL Server - How to find Open Transactions
--open transactions with text and plans
--session ID
--login name
--database context
--transaction begin time
--how many log records have been generated by the transaction
--how much log space has been taken up by those log records
--how much log space has been reserved in case the transaction rolls back
--the last T-SQL that was executed in the context of the transaction