Skip to content

Instantly share code, notes, and snippets.

Function Convert-Size {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias("Length")]
[int64]$Size
)
Begin {
If (-Not $ConvertSize) {
@sirsql
sirsql / VeryBasicAGPerf.sql
Created December 30, 2015 18:41
Just provides very basic info around how your AG is doing. Run on primary to see sending stats, run on secondary to see receiving stats (and see how far behind things are)
SELECT db_name(database_id ), database_id as di,
datediff(minute, last_sent_time, last_received_time) AS SendRec,
datediff(minute, last_received_time, last_redone_time) AS RecRedo,
--datediff(minute, last_sent_time, last_redone_time) as MinsRedo,
case when redo_queue_size = 0 then 0
when redo_rate = 0 then 0
else cast(redo_queue_size / (redo_rate*1.0) as numeric(12,3)) end as MinToRedo,
case when log_send_queue_size = 0 then 0
when log_send_rate = 0 then 0
else cast(log_send_queue_size / (log_send_rate*1.0) as numeric(12,3))