IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Administration SQL Server Discussion :

Audit performances SQL server


Sujet :

Administration SQL Server

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2013
    Messages : 21
    Points : 18
    Points
    18
    Par défaut Audit performances SQL server
    Bonjour,

    Depuis quelques temps, des utilisateurs nous ont signalés des ralentissements sur l'une de nos applications métiers.
    Nous avons donc décidé d'effectuer un audit. Seul problème, étant administrateur système et réseau, je ne sais pas trop quoi auditer sur le serveur SQL

    J'ai trouvé des rapports mais comment les interpréter ?

    - Activité connexion:
    Nom : 2.png
Affichages : 1417
Taille : 9,6 Ko

    - Sessions inactives:
    Nom : 1.png
Affichages : 1358
Taille : 6,1 Ko

    - Sessions dormantes:
    Nom : 4.png
Affichages : 1391
Taille : 25,9 Ko


    Auriez-vous des pistes à me donner ?

    Cordialement,
    Benjamin.

  2. #2
    Rédacteur

    Avatar de SQLpro
    Homme Profil pro
    Expert bases de données / SQL / MS SQL Server / Postgresql
    Inscrit en
    Mai 2002
    Messages
    21 766
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Expert bases de données / SQL / MS SQL Server / Postgresql
    Secteur : Conseil

    Informations forums :
    Inscription : Mai 2002
    Messages : 21 766
    Points : 52 561
    Points
    52 561
    Billets dans le blog
    5
    Par défaut
    Voici 5 articles en PDF qui donne les indications primales pour auditer :
    http://sqlpro.developpez.com/optimisation/

    A +
    Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL
    Le site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/
    Blog SQL, SQL Server, SGBDR : http://blog.developpez.com/sqlpro
    Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp.
    Entreprise SQL SPOT : modélisation, conseils, audit, optimisation, formation...
    * * * * * Expertise SQL Server : http://mssqlserver.fr/ * * * * *

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2013
    Messages : 21
    Points : 18
    Points
    18
    Par défaut
    Bonjour et merci pour votre réponse.

    J'ai regardé les liens que vous m'avez donné et c'est très instructif.
    Ce que je cherche en fait, se sont les seuils à respecter.
    Je suis tombé sur un listing où certains y sont définit :
    Nom : 20.png
Affichages : 1541
Taille : 36,9 Ko
    Nom : 21.png
Affichages : 1548
Taille : 31,5 Ko

    Est-ce que selon vous, les seuils sont cohérents ?
    Sur la partie SQL (encadré rouge), auriez-vous des seuils à me conseiller ?

    Merci !

    Cordialement,
    Benjamin

  4. #4
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2013
    Messages : 21
    Points : 18
    Points
    18
    Par défaut
    Frédéric,

    J'ai trouvé sur votre blog des requêtes à effectuer pour mesurer la qualité intrinsèque d’une base de données:
    http://blog.developpez.com/sqlpro/p1...ite_sql_server

    Après les avoir testé, j'ai les résultats suivants pour:
    - Requêtes obèses: aucune
    - Stockage:
    Nom : 22.png
Affichages : 1364
Taille : 7,0 Ko
    - Contraintes:
    Nom : 23.png
Affichages : 1322
Taille : 2,7 Ko

    Quels conseils pouvez-vous me donner ?

    Juste pour information, nous nous occupons juste de la partie Systèmes et réseaux, et c'est une entreprise externe qui s'occupe des bases de données. C'est pourquoi nous souhaitons faire un audit en interne pour justifier au près du prestataire, des problèmes de performances, malgré que nous n'ayons pas forcément les compétences

    Ha oui, il manque un opérateur dans votre requête (ligne 52 après RATIO_CHECK) sinon celle-ci ne s'exécute pas:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    WHEN RATIO_CHECK ' ' 100 THEN 'excellent'
    Cordialement,
    benjamin.

  5. #5
    Membre éprouvé
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Août 2009
    Messages
    623
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Août 2009
    Messages : 623
    Points : 1 049
    Points
    1 049
    Par défaut
    Bonjour,
    Déjà pour commencer, est ce qu'il y a des plans de maintenance ? (update stat et reorg/rebuild d'index)
    Blog Perso | Kankuru (logiciel gratuit pour SQL Server)

  6. #6
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2013
    Messages : 21
    Points : 18
    Points
    18
    Par défaut
    Bonjour,
    Le plan de maintenance est le suivant:
    Nom : 26.png
Affichages : 1494
Taille : 14,1 Ko

    Cordialement,
    Benjamin.

  7. #7
    Rédacteur

    Avatar de SQLpro
    Homme Profil pro
    Expert bases de données / SQL / MS SQL Server / Postgresql
    Inscrit en
    Mai 2002
    Messages
    21 766
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Expert bases de données / SQL / MS SQL Server / Postgresql
    Secteur : Conseil

    Informations forums :
    Inscription : Mai 2002
    Messages : 21 766
    Points : 52 561
    Points
    52 561
    Billets dans le blog
    5
    Par défaut
    Citation Envoyé par benji22fr Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    WHEN RATIO_CHECK ' ' 100 THEN 'excellent'
    Cordialement,
    benjamin.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    WHEN RATIO_CHECK >= 100 THEN 'excellent'
    A +
    Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL
    Le site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/
    Blog SQL, SQL Server, SGBDR : http://blog.developpez.com/sqlpro
    Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp.
    Entreprise SQL SPOT : modélisation, conseils, audit, optimisation, formation...
    * * * * * Expertise SQL Server : http://mssqlserver.fr/ * * * * *

  8. #8
    Membre du Club
    Homme Profil pro
    Expert Performance Tuning & Architecte BI/DWH
    Inscrit en
    Février 2004
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Expert Performance Tuning & Architecte BI/DWH
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2004
    Messages : 1
    Points : 65
    Points
    65
    Par défaut
    Citation Envoyé par benji22fr Voir le message
    Bonjour et merci pour votre réponse.

    J'ai regardé les liens que vous m'avez donné et c'est très instructif.
    Ce que je cherche en fait, se sont les seuils à respecter.
    Je suis tombé sur un listing où certains y sont définit :
    ...

    Est-ce que selon vous, les seuils sont cohérents ?
    Sur la partie SQL (encadré rouge), auriez-vous des seuils à me conseiller ?

    Merci !

    Cordialement,
    Benjamin


    Je travaille souvent sur des audits de performances bases de données (SQL Serveur, Oracle ou SAP HANA) et pour SQL Server j'utilise le compteur perfmon PLE (Page Life Expectancy ou Durée de vie en mémoire) afin de déterminer si une instance MSSQL subit un stress mémoire. Mon échelle de valeur est assez personnelle, mais je considère qu'en dessous de 300 (ms), le stress mémoire est très important. Cela signifie qu'une page de données en mémoire ne reste en moyenne que 300 ms : les pages sont brassées très rapidement afin d'éjecter les pages les plus anciennes et accueillir les nouvelles.

    Le suivi historique est important afin de bien déterminer si le stress a lieu sur une période courte ou longue.
    Un exemple d'étude pour un audit de performance que j'ai réalisé sur SQL Serveur et sur ce compteur en particulier :

    Nom : PLE_history.jpg
Affichages : 1421
Taille : 59,3 Ko

    Ici l'instance MSSQL est particulièrement stressée (en mémoire) la nuit entre 0h et 7h

    Il y a d'autres exemples sur le site d'architecture & performance : audits de performance

  9. #9
    Modérateur

    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Janvier 2005
    Messages
    5 826
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2005
    Messages : 5 826
    Points : 12 371
    Points
    12 371
    Par défaut
    Bonjour,

    Le nombre 300 est une recommandation faite par Microsoft pour SQL Server 2000; par ailleurs, il n'est pas en millisecondes, mais en secondes : il suffit de lire la description du compteur sous PerfMon pour s'en rendre compte.
    Ensuite, étant donné que sous SQL Server 2000, les bases de données n'occupaient pas le volume qu'elles occupent aujourd'hui, ni qu'elles pouvaient subir la même charge de travail, ni que les serveurs disposaient d'autant de RAM que cela est possible aujourd'hui, ce nombre est plutôt obsolète.

    Restons sur ce chiffre : une page de données fait 8Ko, dont 8060 octets sont utiles au stockage des données. Le reste contient, entre (beaucoup d')autres, un compteur qui est incrémenté à chaque fois que la page est accédée, et décrémenté périodiquement, ce qui permet au moteur de choisir les pages a évincer du cache les premières pour faire place à d'autres requises par une requête en cours d'exécution. L'espérance de vie des pages en secondes indique combien de temps en moyenne une page reste en RAM avant d'être évincée pour faire place à d'autres pages provenant directement du disque. On en déduit donc assez simplement que si la PLE est basse, au moins une requête force le moteur à aller chercher des données sur disque, puisqu'elles ne sont pas en RAM. Si l'ensemble des pages qui sont en RAM reste en cache 5 minutes en moyenne, on comprend que cela est faible, puisque d'une certaine manière, cela signifie que tout le cache est renouvelé toutes les 5 minutes. Imaginez donc si c'était en millisecondes !

    Les serveurs modernes disposant de plusieurs nœuds NUMA, ce qui n'était pas le cas lorsque le nombre 300 a été émis comme une recommandation par Microsoft, il se peut que la PLE pour un nœud soit "bonne", et que celle d'un autre nœud soit basse. Si donc on s'en tient seulement au compteur de performance Buffer Manager : Page Life Expectancy, qui fait la moyenne de la PLE de tous les nœuds NUMA que l'instance SQL Server "voit", l'image que l'on obtient est biaisée, pour ne pas dire fausse.

    Il existe bien sûr un compteur par nœud NUMA : Buffer Node : Page Life Expectancy. On retrouve ces deux compteurs exposés par la DMV sys.dm_os_performance_counters en filtrant par counter_name = 'Page life expectancy'. On voit bien dans ce dernier cas le compteur du Buffer Manager qui n'a pas d'instance, et le compteur Buffer Node qui en a une; il y a autant de lignes pour ce compteur qu'il y a de noeuds visibles par SQL Server.

    J'ai donc pour habitude de faire une règle de trois avec la recommandation de Microsoft, en considérant qu'elle a été faite pour des serveurs disposant de 4 à 8Go de RAM, par ailleurs non-virtualisés.
    Je vous invite à en lire un peu plus là-dessus ici.

    Au delà de toutes ces considérations, il est important d'avoir une baseline : 300 est une recommandation, mais ce qui est important, c'est de savoir quelle est la valeur de la PLE quand votre serveur fonctionne, pour votre charge de travail, correctement. Si l'on journalise cela, on a une idée de la valeur "normale" et donc de valeurs basses pour ce compteur.

    Par extension, PLE est une des facettes de mesure de la performance d'une instance SQL Server, mais il y en a de nombreuses autres.
    Une méthode souvent utilisée est l'étude des attentes, qui sont exposées par la DMV sys.dm_os_wait_stats. Celle-ci cumule depuis le dernier redémarrage de l'instance (donc attention, c'est global à toutes les bases de données hébergées par l'instance) ou bien depuis la dernière remise à zéro manuelle (DBCC SQLPERF( 'sys.dm_os_wait_stats' , CLEAR)), le nombre, la durée, et bien sûr le type d'attentes qui se sont produits.
    On peut aussi procéder par la prise de deux photos à un intervalle défini, et étudier les différences; en s'aidant de la requête proposée par Paul Randal, on aboutit au lot suivant :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    DECLARE @delay_length char(8) = '00:10:00' -- HH:mm:ss
    ----------------------------------------------------------------
    SET NOCOUNT ON
     
    IF OBJECT_ID('TempDB.dbo.#WAIT_1') IS NOT NULL
    BEGIN
    	DROP TABLE #WAIT_1
    END
     
    IF OBJECT_ID('TempDB.dbo.#WAIT_2') IS NOT NULL
    BEGIN
    	DROP TABLE #WAIT_2
    END
     
    IF OBJECT_ID('TempDB.dbo.#WAIT_DESCRIPTION') IS NULL
    BEGIN
    	CREATE TABLE #WAIT_DESCRIPTION
    	(
    		wait_type varchar(60)
    		, description varchar(max)
    	)
     
    	INSERT INTO #WAIT_DESCRIPTION
    	VALUES ('ABR', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('ASSEMBLY_LOAD', 'Occurs during exclusive access to assembly loading.')
    	, ('ASYNC_DISKPOOL_LOCK', 'Occurs when there is an attempt to synchronize parallel threads that are performing tasks such as creating or initializing a file.')
    	, ('ASYNC_IO_COMPLETION', 'Occurs when a task is waiting for I/Os to finish.')
    	, ('ASYNC_NETWORK_IO', 'Occurs on network writes when the task is blocked behind the network. Verify that the client is processing data from the server.')
    	, ('AUDIT_GROUPCACHE_LOCK', 'Occurs when there is a wait on a lock that controls access to a special cache. The cache contains information about which audits are being used to audit each audit action group.')
    	, ('AUDIT_LOGINCACHE_LOCK', 'Occurs when there is a wait on a lock that controls access to a special cache. The cache contains information about which audits are being used to audit login audit action groups.')
    	, ('AUDIT_ON_DEMAND_TARGET_LOCK', 'Occurs when there is a wait on a lock that is used to ensure single initialization of audit related Extended Event targets.')
    	, ('AUDIT_XE_SESSION_MGR', 'Occurs when there is a wait on a lock that is used to synchronize the starting and stopping of audit related Extended Events sessions.')
    	, ('BACKUP', 'Occurs when a task is blocked as part of backup processing.')
    	, ('BACKUP_OPERATOR', 'Occurs when a task is waiting for a tape mount. To view the tape status, query sys.dm_io_backup_tapes. If a mount operation is not pending, this wait type may indicate a hardware problem with the tape drive.')
    	, ('BACKUPBUFFER', 'Occurs when a backup task is waiting for data, or is waiting for a buffer in which to store data. This type is not typical, except when a task is waiting for a tape mount.')
    	, ('BACKUPIO', 'Occurs when a backup task is waiting for data, or is waiting for a buffer in which to store data. This type is not typical, except when a task is waiting for a tape mount.')
    	, ('BACKUPTHREAD', 'Occurs when a task is waiting for a backup task to finish. Wait times may be long, from several minutes to several hours. If the task that is being waited on is in an I/O process, this type does not indicate a problem.')
    	, ('BAD_PAGE_PROCESS', 'Occurs when the background suspect page logger is trying to avoid running more than every five seconds. Excessive suspect pages cause the logger to run frequently.')
    	, ('BROKER_CONNECTION_RECEIVE_TASK', 'Occurs when waiting for access to receive a message on a connection endpoint. Receive access to the endpoint is serialized.')
    	, ('BROKER_ENDPOINT_STATE_MUTEX', 'Occurs when there is contention to access the state of a Service Broker connection endpoint. Access to the state for changes is serialized.')
    	, ('BROKER_EVENTHANDLER', 'Occurs when a task is waiting in the primary event handler of the Service Broker. This should occur very briefly.')
    	, ('BROKER_INIT', 'Occurs when initializing Service Broker in each active database. This should occur infrequently.')
    	, ('BROKER_MASTERSTART', 'Occurs when a task is waiting for the primary event handler of the Service Broker to start. This should occur very briefly.')
    	, ('BROKER_RECEIVE_WAITFOR', 'Occurs when the RECEIVE WAITFOR is waiting. This is typical if no messages are ready to be received.')
    	, ('BROKER_REGISTERALLENDPOINTS', 'Occurs during the initialization of a Service Broker connection endpoint. This should occur very briefly.')
    	, ('BROKER_SERVICE', 'Occurs when the Service Broker destination list that is associated with a target service is updated or re-prioritized.')
    	, ('BROKER_SHUTDOWN', 'Occurs when there is a planned shutdown of Service Broker. This should occur very briefly, if at all.')
    	, ('BROKER_TASK_STOP', 'Occurs when the Service Broker queue task handler tries to shut down the task. The state check is serialized and must be in a running state beforehand.')
    	, ('BROKER_TO_FLUSH', 'Occurs when the Service Broker lazy flusher flushes the in-memory transmission objects to a work table.')
    	, ('BROKER_TRANSMITTER', 'Occurs when the Service Broker transmitter is waiting for work.')
    	, ('BUILTIN_HASHKEY_MUTEX', 'May occur after startup of instance, while internal data structures are initializing. Will not recur once data structures have initialized.')
    	, ('CHECK_PRINT_RECORD', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('CHECKPOINT_QUEUE', 'Occurs while the checkpoint task is waiting for the next checkpoint request.')
    	, ('CHKPT', 'Occurs at server startup to tell the checkpoint thread that it can start.')
    	, ('CLEAR_DB', 'Occurs during operations that change the state of a database, such as opening or closing a database.')
    	, ('CLR_AUTO_EVENT', 'Occurs when a task is currently performing common language runtime (CLR) execution and is waiting for a particular autoevent to be initiated. Long waits are typical, and do not indicate a problem.')
    	, ('CLR_CRST', 'Occurs when a task is currently performing CLR execution and is waiting to enter a critical section of the task that is currently being used by another task.')
    	, ('CLR_JOIN', 'Occurs when a task is currently performing CLR execution and waiting for another task to end. This wait state occurs when there is a join between tasks.')
    	, ('CLR_MANUAL_EVENT', 'Occurs when a task is currently performing CLR execution and is waiting for a specific manual event to be initiated.')
    	, ('CLR_MEMORY_SPY', 'Occurs during a wait on lock acquisition for a data structure that is used to record all virtual memory allocations that come from CLR. The data structure is locked to maintain its integrity if there is parallel access.')
    	, ('CLR_MONITOR', 'Occurs when a task is currently performing CLR execution and is waiting to obtain a lock on the monitor.')
    	, ('CLR_RWLOCK_READER', 'Occurs when a task is currently performing CLR execution and is waiting for a reader lock.')
    	, ('CLR_RWLOCK_WRITER', 'Occurs when a task is currently performing CLR execution and is waiting for a writer lock.')
    	, ('CLR_SEMAPHORE', 'Occurs when a task is currently performing CLR execution and is waiting for a semaphore.')
    	, ('CLR_TASK_START', 'Occurs while waiting for a CLR task to complete startup.')
    	, ('CLRHOST_STATE_ACCESS', 'Occurs where there is a wait to acquire exclusive access to the CLR-hosting data structures. This wait type occurs while setting up or tearing down the CLR runtime.')
    	, ('CMEMTHREAD', 'Occurs when a task is waiting on a thread-safe memory object. The wait time might increase when there is contention caused by multiple tasks trying to allocate memory from the same memory object.')
    	, ('CXPACKET', 'Occurs when trying to synchronize the query processor exchange iterator. You may consider lowering the degree of parallelism if contention on this wait type becomes a problem.')
    	, ('CXROWSET_SYNC', 'Occurs during a parallel range scan.')
    	, ('DAC_INIT', 'Occurs while the dedicated administrator connection is initializing.')
    	, ('DBMIRROR_DBM_EVENT', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('DBMIRROR_DBM_MUTEX', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('DBMIRROR_EVENTS_QUEUE', 'Occurs when database mirroring waits for events to process.')
    	, ('DBMIRROR_SEND', 'Occurs when a task is waiting for a communications backlog at the network layer to clear to be able to send messages. Indicates that the communications layer is starting to become overloaded and affect the database mirroring data throughput.')
    	, ('DBMIRROR_WORKER_QUEUE', 'Indicates that the database mirroring worker task is waiting for more work.')
    	, ('DBMIRRORING_CMD', 'Occurs when a task is waiting for log records to be flushed to disk. This wait state is expected to be held for long periods of time.')
    	, ('DEADLOCK_ENUM_MUTEX', 'Occurs when the deadlock monitor and sys.dm_os_waiting_tasks try to make sure that SQL Server is not running multiple deadlock searches at the same time.')
    	, ('DEADLOCK_TASK_SEARCH', 'Large waiting time on this resource indicates that the server is executing queries on top of sys.dm_os_waiting_tasks, and these queries are blocking deadlock monitor from running deadlock search. This wait type is used by deadlock monitor only. Queries on top of sys.dm_os_waiting_tasks use DEADLOCK_ENUM_MUTEX.')
    	, ('DEBUG', 'Occurs during Transact-SQL and CLR debugging for internal synchronization.')
    	, ('DISABLE_VERSIONING', 'Occurs when SQL Server polls the version transaction manager to see whether the timestamp of the earliest active transaction is later than the timestamp of when the state started changing. If this is this case, all the snapshot transactions that were started before the ALTER DATABASE statement was run have finished. This wait state is used when SQL Server disables versioning by using the ALTER DATABASE statement.')
    	, ('DISKIO_SUSPEND', 'Occurs when a task is waiting to access a file when an external backup is active. This is reported for each waiting user process. A count larger than five per user process may indicate that the external backup is taking too much time to finish.')
    	, ('DISPATCHER_QUEUE_SEMAPHORE', 'Occurs when a thread from the dispatcher pool is waiting for more work to process. The wait time for this wait type is expected to increase when the dispatcher is idle.')
    	, ('DLL_LOADING_MUTEX', 'Occurs once while waiting for the XML parser DLL to load.')
    	, ('DROPTEMP', 'Occurs between attempts to drop a temporary object if the previous attempt failed. The wait duration grows exponentially with each failed drop attempt.')
    	, ('DTC', 'Occurs when a task is waiting on an event that is used to manage state transition. This state controls when the recovery of Microsoft Distributed Transaction Coordinator (MS DTC) transactions occurs after SQL Server receives notification that the MS DTC service has become unavailable. This state also describes a task that is waiting when a commit of a MS DTC transaction is initiated by SQL Server and SQL Server is waiting for the MS DTC commit to finish.')
    	, ('DTC_ABORT_REQUEST', 'Occurs in a MS DTC worker session when the session is waiting to take ownership of a MS DTC transaction. After MS DTC owns the transaction, the session can roll back the transaction. Generally, the session will wait for another session that is using the transaction.')
    	, ('DTC_RESOLVE', 'Occurs when a recovery task is waiting for the master database in a cross-database transaction so that the task can query the outcome of the transaction.')
    	, ('DTC_STATE', 'Occurs when a task is waiting on an event that protects changes to the internal MS DTC global state object. This state should be held for very short periods of time.')
    	, ('DTC_TMDOWN_REQUEST', 'Occurs in a MS DTC worker session when SQL Server receives notification that the MS DTC service is not available. First, the worker will wait for the MS DTC recovery process to start. Then, the worker waits to obtain the outcome of the distributed transaction that the worker is working on. This may continue until the connection with the MS DTC service has been reestablished.')
    	, ('DTC_WAITFOR_OUTCOME', 'Occurs when recovery tasks wait for MS DTC to become active to enable the resolution of prepared transactions.')
    	, ('DUMP_LOG_COORDINATOR', 'Occurs when a main task is waiting for a subtask to generate data. Ordinarily, this state does not occur. A long wait indicates an unexpected blockage. The subtask should be investigated.')
    	, ('DUMPTRIGGER', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('EC', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('EE_PMOLOCK', 'Occurs during synchronization of certain types of memory allocations during statement execution.')
    	, ('EE_SPECPROC_MAP_INIT', 'Occurs during synchronization of internal procedure hash table creation. This wait can only occur during the initial accessing of the hash table after the SQL Server instance starts.')
    	, ('ENABLE_VERSIONING', 'Occurs when SQL Server waits for all update transactions in this database to finish before declaring the database ready to transition to snapshot isolation allowed state. This state is used when SQL Server enables snapshot isolation by using the ALTER DATABASE statement.')
    	, ('ERROR_REPORTING_MANAGER', 'Occurs during synchronization of multiple concurrent error log initializations.')
    	, ('EXCHANGE', 'Occurs during synchronization in the query processor exchange iterator during parallel queries.')
    	, ('EXECSYNC', 'Occurs during parallel queries while synchronizing in query processor in areas not related to the exchange iterator. Examples of such areas are bitmaps, large binary objects (LOBs), and the spool iterator. LOBs may frequently use this wait state.')
    	, ('EXECUTION_PIPE_EVENT_INTERNAL', 'Occurs during synchronization between producer and consumer parts of batch execution that are submitted through the connection context.')
    	, ('FAILPOINT', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FCB_REPLICA_READ', 'Occurs when the reads of a snapshot (or a temporary snapshot created by DBCC) sparse file are synchronized.')
    	, ('FCB_REPLICA_WRITE', 'Occurs when the pushing or pulling of a page to a snapshot (or a temporary snapshot created by DBCC) sparse file is synchronized.')
    	, ('FS_FC_RWLOCK', 'Occurs when there is a wait by the FILESTREAM garbage collector to do either of the following: 1) Disable garbage collection (used by backup and restore). 2) Execute one cycle of the FILESTREAM garbage collector.')
    	, ('FS_GARBAGE_COLLECTOR_SHUTDOWN', 'Occurs when the FILESTREAM garbage collector is waiting for cleanup tasks to be completed.')
    	, ('FS_HEADER_RWLOCK', 'Occurs when there is a wait to acquire access to the FILESTREAM header of a FILESTREAM data container to either read or update contents in the FILESTREAM header file (Filestream.hdr).')
    	, ('FS_LOGTRUNC_RWLOCK', 'Occurs when there is a wait to acquire access to FILESTREAM log truncation to do either of the following: 1) Temporarily disable FILESTREAM log (FSLOG) truncation (used by backup and restore). 2) Execute one cycle of FSLOG truncation.')
    	, ('FSA_FORCE_OWN_XACT', 'Occurs when a FILESTREAM file I/O operation needs to bind to the associated transaction, but the transaction is currently owned by another session.')
    	, ('FSAGENT', 'Occurs when a FILESTREAM file I/O operation is waiting for a FILESTREAM agent resource that is being used by another file I/O operation.')
    	, ('FSTR_CONFIG_MUTEX', 'Occurs when there is a wait for another FILESTREAM feature reconfiguration to be completed.')
    	, ('FSTR_CONFIG_RWLOCK', 'Occurs when there is a wait to serialize access to the FILESTREAM configuration parameters.')
    	, ('FT_METADATA_MUTEX', 'Documented for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FT_RESTART_CRAWL', 'Occurs when a full-text crawl needs to restart from a last known good point to recover from a transient failure. The wait lets the worker tasks currently working on that population to complete or exit the current step.')
    	, ('FULLTEXT_GATHERER', 'Occurs during synchronization of full-text operations.')
    	, ('GUARDIAN', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('HADR_DATABASE_WAIT_FOR_TRANSITION_TO_VERSIONING', 'Occurs when a query on object(s) in a readable secondary database of an AlwaysOn availability group is blocked on row versioning while waiting to become ready for queries to be processed under snapshot isolation.')
    	, ('HTTP_ENUMERATION', 'Occurs at startup to enumerate the HTTP endpoints to start HTTP.')
    	, ('HTTP_START', 'Occurs when a connection is waiting for HTTP to complete initialization.')
    	, ('IMPPROV_IOWAIT', 'Occurs when SQL Server waits for a bulkload I/O to finish.')
    	, ('INTERNAL_TESTING', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('IO_AUDIT_MUTEX', 'Occurs during synchronization of trace event buffers.')
    	, ('IO_COMPLETION', 'Occurs while waiting for I/O operations to complete. This wait type generally represents non-data page I/Os. Data page I/O completion waits appear as PAGEIOLATCH_* waits.')
    	, ('IO_RETRY', 'Occurs when an I/O operation such as a read or a write to disk fails because of insufficient resources, and is then retried.')
    	, ('IOAFF_RANGE_QUEUE', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('KSOURCE_WAKEUP', 'Used by the service control task while waiting for requests from the Service Control Manager. Long waits are expected and do not indicate a problem.')
    	, ('KTM_ENLISTMENT', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('KTM_RECOVERY_MANAGER', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('KTM_RECOVERY_RESOLUTION', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('LATCH_DT', 'Occurs when waiting for a DT (destroy) latch. This does not include buffer latches or transaction mark latches. A listing of LATCH_* waits is available in sys.dm_os_latch_stats. Note that sys.dm_os_latch_stats groups LATCH_NL, LATCH_SH, LATCH_UP, LATCH_EX, and LATCH_DT waits together.')
    	, ('LATCH_EX', 'Occurs when waiting for an EX (exclusive) latch. This does not include buffer latches or transaction mark latches. A listing of LATCH_* waits is available in sys.dm_os_latch_stats. Note that sys.dm_os_latch_stats groups LATCH_NL, LATCH_SH, LATCH_UP, LATCH_EX, and LATCH_DT waits together.')
    	, ('LATCH_KP', 'Occurs when waiting for a KP (keep) latch. This does not include buffer latches or transaction mark latches. A listing of LATCH_* waits is available in sys.dm_os_latch_stats. Note that sys.dm_os_latch_stats groups LATCH_NL, LATCH_SH, LATCH_UP, LATCH_EX, and LATCH_DT waits together.')
    	, ('LATCH_NL', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('LATCH_SH', 'Occurs when waiting for an SH (share) latch. This does not include buffer latches or transaction mark latches. A listing of LATCH_* waits is available in sys.dm_os_latch_stats. Note that sys.dm_os_latch_stats groups LATCH_NL, LATCH_SH, LATCH_UP, LATCH_EX, and LATCH_DT waits together.')
    	, ('LATCH_UP', 'Occurs when waiting for an UP (update) latch. This does not include buffer latches or transaction mark latches. A listing of LATCH_* waits is available in sys.dm_os_latch_stats. Note that sys.dm_os_latch_stats groups LATCH_NL, LATCH_SH, LATCH_UP, LATCH_EX, and LATCH_DT waits together.')
    	, ('LAZYWRITER_SLEEP', 'Occurs when lazywriter tasks are suspended. This is a measure of the time spent by background tasks that are waiting. Do not consider this state when you are looking for user stalls.')
    	, ('LCK_M_BU', 'Occurs when a task is waiting to acquire a Bulk Update (BU) lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_IS', 'Occurs when a task is waiting to acquire an Intent Shared (IS) lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_IU', 'Occurs when a task is waiting to acquire an Intent Update (IU) lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_IX', 'Occurs when a task is waiting to acquire an Intent Exclusive (IX) lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RIn_NL', 'Occurs when a task is waiting to acquire a NULL lock on the current key value, and an Insert Range lock between the current and previous key. A NULL lock on the key is an instant release lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RIn_S', 'Occurs when a task is waiting to acquire a shared lock on the current key value, and an Insert Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RIn_U', 'Task is waiting to acquire an Update lock on the current key value, and an Insert Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RIn_X', 'Occurs when a task is waiting to acquire an Exclusive lock on the current key value, and an Insert Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RS_S', 'Occurs when a task is waiting to acquire a Shared lock on the current key value, and a Shared Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RS_U', 'Occurs when a task is waiting to acquire an Update lock on the current key value, and an Update Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RX_S', 'Occurs when a task is waiting to acquire a Shared lock on the current key value, and an Exclusive Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RX_U', 'Occurs when a task is waiting to acquire an Update lock on the current key value, and an Exclusive range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_RX_X', 'Occurs when a task is waiting to acquire an Exclusive lock on the current key value, and an Exclusive Range lock between the current and previous key. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_S', 'Occurs when a task is waiting to acquire a Shared lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_SCH_M', 'Occurs when a task is waiting to acquire a Schema Modify lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_SCH_S', 'Occurs when a task is waiting to acquire a Schema Share lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_SIU', 'Occurs when a task is waiting to acquire a Shared With Intent Update lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_SIX', 'Occurs when a task is waiting to acquire a Shared With Intent Exclusive lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_U', 'Occurs when a task is waiting to acquire an Update lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_UIX', 'Occurs when a task is waiting to acquire an Update With Intent Exclusive lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LCK_M_X', 'Occurs when a task is waiting to acquire an Exclusive lock. For a lock compatibility matrix, see sys.dm_tran_locks (Transact-SQL).')
    	, ('LOGBUFFER', 'Occurs when a task is waiting for space in the log buffer to store a log record. Consistently high values may indicate that the log devices cannot keep up with the amount of log being generated by the server.')
    	, ('LOGGENERATION', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('LOGMGR', 'Occurs when a task is waiting for any outstanding log I/Os to finish before shutting down the log while closing the database.')
    	, ('LOGMGR_FLUSH', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('LOGMGR_QUEUE', 'Occurs while the log writer task waits for work requests.')
    	, ('LOGMGR_RESERVE_APPEND', 'Occurs when a task is waiting to see whether log truncation frees up log space to enable the task to write a new log record. Consider increasing the size of the log file(s) for the affected database to reduce this wait.')
    	, ('LOWFAIL_MEMMGR_QUEUE', 'Occurs while waiting for memory to be available for use.')
    	, ('MISCELLANEOUS', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('MSQL_DQ', 'Occurs when a task is waiting for a distributed query operation to finish. This is used to detect potential Multiple Active Result Set (MARS) application deadlocks. The wait ends when the distributed query call finishes.')
    	, ('MSQL_XACT_MGR_MUTEX', 'Occurs when a task is waiting to obtain ownership of the session transaction manager to perform a session level transaction operation.')
    	, ('MSQL_XACT_MUTEX', 'Occurs during synchronization of transaction usage. A request must acquire the mutex before it can use the transaction.')
    	, ('MSQL_XP', 'Occurs when a task is waiting for an extended stored procedure to end. SQL Server uses this wait state to detect potential MARS application deadlocks. The wait stops when the extended stored procedure call ends.')
    	, ('MSSEARCH', 'Occurs during Full-Text Search calls. This wait ends when the full-text operation completes. It does not indicate contention, but rather the duration of full-text operations.')
    	, ('NET_WAITFOR_PACKET', 'Occurs when a connection is waiting for a network packet during a network read.')
    	, ('OLEDB', 'Occurs when SQL Server calls the SQL Server Native Client OLE DB Provider. This wait type is not used for synchronization. Instead, it indicates the duration of calls to the OLE DB provider.')
    	, ('ONDEMAND_TASK_QUEUE', 'Occurs while a background task waits for high priority system task requests. Long wait times indicate that there have been no high priority requests to process, and should not cause concern.')
    	, ('PAGEIOLATCH_DT', 'Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Destroy mode. Long waits may indicate problems with the disk subsystem.')
    	, ('PAGEIOLATCH_EX', 'Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Exclusive mode. Long waits may indicate problems with the disk subsystem.')
    	, ('PAGEIOLATCH_KP', 'Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Keep mode. Long waits may indicate problems with the disk subsystem.')
    	, ('PAGEIOLATCH_NL', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PAGEIOLATCH_SH', 'Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Shared mode. Long waits may indicate problems with the disk subsystem.')
    	, ('PAGEIOLATCH_UP', 'Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Update mode. Long waits may indicate problems with the disk subsystem.')
    	, ('PAGELATCH_DT', 'Occurs when a task is waiting on a latch for a buffer that is not in an I/O request. The latch request is in Destroy mode.')
    	, ('PAGELATCH_EX', 'Occurs when a task is waiting on a latch for a buffer that is not in an I/O request. The latch request is in Exclusive mode.')
    	, ('PAGELATCH_KP', 'Occurs when a task is waiting on a latch for a buffer that is not in an I/O request. The latch request is in Keep mode.')
    	, ('PAGELATCH_NL', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PAGELATCH_SH', 'Occurs when a task is waiting on a latch for a buffer that is not in an I/O request. The latch request is in Shared mode.')
    	, ('PAGELATCH_UP', 'Occurs when a task is waiting on a latch for a buffer that is not in an I/O request. The latch request is in Update mode.')
    	, ('PARALLEL_BACKUP_QUEUE', 'Occurs when serializing output produced by RESTORE HEADERONLY, RESTORE FILELISTONLY, or RESTORE LABELONLY.')
    	, ('PREEMPTIVE_ABR', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PREEMPTIVE_AUDIT_ACCESS_EVENTLOG', 'Occurs when the SQL Server Operating System (SQLOS) scheduler switches to preemptive mode to write an audit event to the Windows event log.')
    	, ('PREEMPTIVE_AUDIT_ACCESS_SECLOG', 'Occurs when the SQLOS scheduler switches to preemptive mode to write an audit event to the Windows Security log.')
    	, ('PREEMPTIVE_CLOSEBACKUPMEDIA', 'Occurs when the SQLOS scheduler switches to preemptive mode to close backup media.')
    	, ('PREEMPTIVE_CLOSEBACKUPTAPE', 'Occurs when the SQLOS scheduler switches to preemptive mode to close a tape backup device.')
    	, ('PREEMPTIVE_CLOSEBACKUPVDIDEVICE', 'Occurs when the SQLOS scheduler switches to preemptive mode to close a virtual backup device.')
    	, ('PREEMPTIVE_CLUSAPI_CLUSTERRESOURCECONTROL', 'Occurs when the SQLOS scheduler switches to preemptive mode to perform Windows failover cluster operations.')
    	, ('PREEMPTIVE_COM_COCREATEINSTANCE', 'Occurs when the SQLOS scheduler switches to preemptive mode to create a COM object.')
    	, ('PREEMPTIVE_SOSTESTING', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PREEMPTIVE_STRESSDRIVER', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PREEMPTIVE_TESTING', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PREEMPTIVE_XETESTING', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('PRINT_ROLLBACK_PROGRESS', 'Used to wait while user processes are ended in a database that has been transitioned by using the ALTER DATABASE termination clause. For more information, see ALTER DATABASE (Transact-SQL).')
    	, ('QPJOB_KILL', 'Indicates that an asynchronous automatic statistics update was canceled by a call to KILL as the update was starting to run. The terminating thread is suspended, waiting for it to start listening for KILL commands. A good value is less than one second.')
    	, ('QPJOB_WAITFOR_ABORT', 'Indicates that an asynchronous automatic statistics update was canceled by a call to KILL when it was running. The update has now completed but is suspended until the terminating thread message coordination is complete. This is an ordinary but rare state, and should be very short. A good value is less than one second.')
    	, ('QRY_MEM_GRANT_INFO_MUTEX', 'Occurs when Query Execution memory management tries to control access to static grant information list. This state lists information about the current granted and waiting memory requests. This state is a simple access control state. There should never be a long wait on this state. If this mutex is not released, all new memory-using queries will stop responding.')
    	, ('QUERY_ERRHDL_SERVICE_DONE', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('QUERY_EXECUTION_INDEX_SORT_EVENT_OPEN', 'Occurs in certain cases when offline create index build is run in parallel, and the different worker threads that are sorting synchronize access to the sort files.')
    	, ('QUERY_NOTIFICATION_MGR_MUTEX', 'Occurs during synchronization of the garbage collection queue in the Query Notification Manager.')
    	, ('QUERY_NOTIFICATION_SUBSCRIPTION_MUTEX', 'Occurs during state synchronization for transactions in Query Notifications.')
    	, ('QUERY_NOTIFICATION_TABLE_MGR_MUTEX', 'Occurs during internal synchronization within the Query Notification Manager.')
    	, ('QUERY_NOTIFICATION_UNITTEST_MUTEX', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('QUERY_OPTIMIZER_PRINT_MUTEX', 'Occurs during synchronization of query optimizer diagnostic output production. This wait type only occurs if diagnostic settings have been enabled under direction of Microsoft Product Support.')
    	, ('QUERY_TRACEOUT', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('QUERY_WAIT_ERRHDL_SERVICE', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('RECOVER_CHANGEDB', 'Occurs during synchronization of database status in warm standby database.')
    	, ('REPL_CACHE_ACCESS', 'Occurs during synchronization on a replication article cache. During these waits, the replication log reader stalls, and data definition language (DDL) statements on a published table are blocked.')
    	, ('REPL_SCHEMA_ACCESS', 'Occurs during synchronization of replication schema version information. This state exists when DDL statements are executed on the replicated object, and when the log reader builds or consumes versioned schema based on DDL occurrence.')
    	, ('REPLICA_WRITES', 'Occurs while a task waits for completion of page writes to database snapshots or DBCC replicas.')
    	, ('REQUEST_DISPENSER_PAUSE', 'Occurs when a task is waiting for all outstanding I/O to complete, so that I/O to a file can be frozen for snapshot backup.')
    	, ('REQUEST_FOR_DEADLOCK_SEARCH', 'Occurs while the deadlock monitor waits to start the next deadlock search. This wait is expected between deadlock detections, and lengthy total waiting time on this resource does not indicate a problem.')
    	, ('RESMGR_THROTTLED', 'Occurs when a new request comes in and is throttled based on the GROUP_MAX_REQUESTS setting.')
    	, ('RESOURCE_QUEUE', 'Occurs during synchronization of various internal resource queues.')
    	, ('RESOURCE_SEMAPHORE', 'Occurs when a query memory request cannot be granted immediately due to other concurrent queries. High waits and wait times may indicate excessive number of concurrent queries, or excessive memory request amounts.')
    	, ('RESOURCE_SEMAPHORE_MUTEX', 'Occurs while a query waits for its request for a thread reservation to be fulfilled. It also occurs when synchronizing query compile and memory grant requests.')
    	, ('RESOURCE_SEMAPHORE_QUERY_COMPILE', 'Occurs when the number of concurrent query compilations reaches a throttling limit. High waits and wait times may indicate excessive compilations, recompiles, or uncachable plans.')
    	, ('RESOURCE_SEMAPHORE_SMALL_QUERY', 'Occurs when memory request by a small query cannot be granted immediately due to other concurrent queries. Wait time should not exceed more than a few seconds, because the server transfers the request to the main query memory pool if it fails to grant the requested memory within a few seconds. High waits may indicate an excessive number of concurrent small queries while the main memory pool is blocked by waiting queries.')
    	, ('SEC_DROP_TEMP_KEY', 'Occurs after a failed attempt to drop a temporary security key before a retry attempt.')
    	, ('SECURITY_MUTEX', 'Occurs when there is a wait for mutexes that control access to the global list of Extensible Key Management (EKM) cryptographic providers and the session-scoped list of EKM sessions.')
    	, ('SEQUENTIAL_GUID', 'Occurs while a new sequential GUID is being obtained.')
    	, ('SERVER_IDLE_CHECK', 'Occurs during synchronization of SQL Server instance idle status when a resource monitor is attempting to declare a SQL Server instance as idle or trying to wake up.')
    	, ('SHUTDOWN', 'Occurs while a shutdown statement waits for active connections to exit.')
    	, ('SLEEP_BPOOL_FLUSH', 'Occurs when a checkpoint is throttling the issuance of new I/Os in order to avoid flooding the disk subsystem.')
    	, ('SLEEP_DBSTARTUP', 'Occurs during database startup while waiting for all databases to recover.')
    	, ('SLEEP_DCOMSTARTUP', 'Occurs once at most during SQL Server instance startup while waiting for DCOM initialization to complete.')
    	, ('SLEEP_MSDBSTARTUP', 'Occurs when SQL Trace waits for the msdb database to complete startup.')
    	, ('SLEEP_SYSTEMTASK', 'Occurs during the start of a background task while waiting for tempdb to complete startup.')
    	, ('SLEEP_TASK', 'Occurs when a task sleeps while waiting for a generic event to occur.')
    	, ('SLEEP_TEMPDBSTARTUP', 'Occurs while a task waits for tempdb to complete startup.')
    	, ('SNI_CRITICAL_SECTION', 'Occurs during internal synchronization within SQL Server networking components.')
    	, ('SNI_HTTP_WAITFOR_0_DISCON', 'Occurs during SQL Server shutdown, while waiting for outstanding HTTP connections to exit.')
    	, ('SNI_LISTENER_ACCESS', 'Occurs while waiting for non-uniform memory access (NUMA) nodes to update state change. Access to state change is serialized.')
    	, ('SNI_TASK_COMPLETION', 'Occurs when there is a wait for all tasks to finish during a NUMA node state change.')
    	, ('SOAP_READ', 'Occurs while waiting for an HTTP network read to complete.')
    	, ('SOAP_WRITE', 'Occurs while waiting for an HTTP network write to complete.')
    	, ('SOS_CALLBACK_REMOVAL', 'Occurs while performing synchronization on a callback list in order to remove a callback. It is not expected for this counter to change after server initialization is completed.')
    	, ('SOS_DISPATCHER_MUTEX', 'Occurs during internal synchronization of the dispatcher pool. This includes when the pool is being adjusted.')
    	, ('SOS_LOCALALLOCATORLIST', 'Occurs during internal synchronization in the SQL Server memory manager.')
    	, ('SOS_MEMORY_USAGE_ADJUSTMENT', 'Occurs when memory usage is being adjusted among pools.')
    	, ('SOS_OBJECT_STORE_DESTROY_MUTEX', 'Occurs during internal synchronization in memory pools when destroying objects from the pool.')
    	, ('SOS_PROCESS_AFFINITY_MUTEX', 'Occurs during synchronizing of access to process affinity settings.')
    	, ('SOS_RESERVEDMEMBLOCKLIST', 'Occurs during internal synchronization in the SQL Server memory manager.')
    	, ('SOS_SCHEDULER_YIELD', 'Occurs when a task voluntarily yields the scheduler for other tasks to execute. During this wait the task is waiting for its quantum to be renewed.')
    	, ('SOS_SMALL_PAGE_ALLOC', 'Occurs during the allocation and freeing of memory that is managed by some memory objects.')
    	, ('SOS_STACKSTORE_INIT_MUTEX', 'Occurs during synchronization of internal store initialization.')
    	, ('SOS_SYNC_TASK_ENQUEUE_EVENT', 'Occurs when a task is started in a synchronous manner. Most tasks in SQL Server are started in an asynchronous manner, in which control returns to the starter immediately after the task request has been placed on the work queue.')
    	, ('SOS_VIRTUALMEMORY_LOW', 'Occurs when a memory allocation waits for a resource manager to free up virtual memory.')
    	, ('SOSHOST_EVENT', 'Occurs when a hosted component, such as CLR, waits on a SQL Server event synchronization object.')
    	, ('SOSHOST_INTERNAL', 'Occurs during synchronization of memory manager callbacks used by hosted components, such as CLR.')
    	, ('SOSHOST_MUTEX', 'Occurs when a hosted component, such as CLR, waits on a SQL Server mutex synchronization object.')
    	, ('SOSHOST_RWLOCK', 'Occurs when a hosted component, such as CLR, waits on a SQL Server reader-writer synchronization object.')
    	, ('SOSHOST_SEMAPHORE', 'Occurs when a hosted component, such as CLR, waits on a SQL Server semaphore synchronization object.')
    	, ('SOSHOST_SLEEP', 'Occurs when a hosted task sleeps while waiting for a generic event to occur. Hosted tasks are used by hosted components such as CLR.')
    	, ('SOSHOST_TRACELOCK', 'Occurs during synchronization of access to trace streams.')
    	, ('SOSHOST_WAITFORDONE', 'Occurs when a hosted component, such as CLR, waits for a task to complete.')
    	, ('SQLCLR_APPDOMAIN', 'Occurs while CLR waits for an application domain to complete startup.')
    	, ('SQLCLR_ASSEMBLY', 'Occurs while waiting for access to the loaded assembly list in the appdomain.')
    	, ('SQLCLR_DEADLOCK_DETECTION', 'Occurs while CLR waits for deadlock detection to complete.')
    	, ('SQLCLR_QUANTUM_PUNISHMENT', 'Occurs when a CLR task is throttled because it has exceeded its execution quantum. This throttling is done in order to reduce the effect of this resource-intensive task on other tasks.')
    	, ('SQLSORT_NORMMUTEX', 'Occurs during internal synchronization, while initializing internal sorting structures.')
    	, ('SQLSORT_SORTMUTEX', 'Occurs during internal synchronization, while initializing internal sorting structures.')
    	, ('SQLTRACE_BUFFER_FLUSH', 'Occurs when a task is waiting for a background task to flush trace buffers to disk every four seconds.')
    	, ('SQLTRACE_LOCK', 'Occurs during synchronization on trace buffers during a file trace.')
    	, ('SQLTRACE_SHUTDOWN', 'Occurs while trace shutdown waits for outstanding trace events to complete.')
    	, ('SQLTRACE_WAIT_ENTRIES', 'Occurs while a SQL Trace event queue waits for packets to arrive on the queue.')
    	, ('SRVPROC_SHUTDOWN', 'Occurs while the shutdown process waits for internal resources to be released to shutdown cleanly.')
    	, ('TEMPOBJ', 'Occurs when temporary object drops are synchronized. This wait is rare, and only occurs if a task has requested exclusive access for temp table drops.')
    	, ('THREADPOOL', 'Occurs when a task is waiting for a worker to run on. This can indicate that the maximum worker setting is too low, or that batch executions are taking unusually long, thus reducing the number of workers available to satisfy other batches.')
    	, ('TIMEPRIV_TIMEPERIOD', 'Occurs during internal synchronization of the Extended Events timer.')
    	, ('TRACEWRITE', 'Occurs when the SQL Trace rowset trace provider waits for either a free buffer or a buffer with events to process.')
    	, ('TRAN_MARKLATCH_DT', 'Occurs when waiting for a destroy mode latch on a transaction mark latch. Transaction mark latches are used for synchronization of commits with marked transactions.')
    	, ('TRAN_MARKLATCH_EX', 'Occurs when waiting for an exclusive mode latch on a marked transaction. Transaction mark latches are used for synchronization of commits with marked transactions.')
    	, ('TRAN_MARKLATCH_KP', 'Occurs when waiting for a keep mode latch on a marked transaction. Transaction mark latches are used for synchronization of commits with marked transactions.')
    	, ('TRAN_MARKLATCH_NL', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('TRAN_MARKLATCH_SH', 'Occurs when waiting for a shared mode latch on a marked transaction. Transaction mark latches are used for synchronization of commits with marked transactions.')
    	, ('TRAN_MARKLATCH_UP', 'Occurs when waiting for an update mode latch on a marked transaction. Transaction mark latches are used for synchronization of commits with marked transactions.')
    	, ('TRANSACTION_MUTEX', 'Occurs during synchronization of access to a transaction by multiple batches.')
    	, ('UTIL_PAGE_ALLOC', 'Occurs when transaction log scans wait for memory to be available during memory pressure.')
    	, ('VIA_ACCEPT', 'Occurs when a Virtual Interface Adapter (VIA) provider connection is completed during startup.')
    	, ('VIEW_DEFINITION_MUTEX', 'Occurs during synchronization on access to cached view definitions.')
    	, ('WAIT_FOR_RESULTS', 'Occurs when waiting for a query notification to be triggered.')
    	, ('WAITFOR', 'Occurs as a result of a WAITFOR Transact-SQL statement. The duration of the wait is determined by the parameters to the statement. This is a user-initiated wait.')
    	, ('WAITFOR_TASKSHUTDOWN', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('WAITSTAT_MUTEX', 'Occurs during synchronization of access to the collection of statistics used to populate sys.dm_os_wait_stats.')
    	, ('WCC', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('WORKTBL_DROP', 'Occurs while pausing before retrying, after a failed worktable drop.')
    	, ('WRITE_COMPLETION', 'Occurs when a write operation is in progress.')
    	, ('WRITELOG', 'Occurs while waiting for a log flush to complete. Common operations that cause log flushes are checkpoints and transaction commits.')
    	, ('XACT_OWN_TRANSACTION', 'Occurs while waiting to acquire ownership of a transaction.')
    	, ('XACT_RECLAIM_SESSION', 'Occurs while waiting for the current owner of a session to release ownership of the session.')
    	, ('XACTLOCKINFO', 'Occurs during synchronization of access to the list of locks for a transaction. In addition to the transaction itself, the list of locks is accessed by operations such as deadlock detection and lock migration during page splits.')
    	, ('XACTWORKSPACE_MUTEX', 'Occurs during synchronization of defections from a transaction, as well as the number of database locks between enlist members of a transaction.')
    	, ('XE_BUFFERMGR_ALLPROCESSED_EVENT', 'Occurs when Extended Events session buffers are flushed to targets. This wait occurs on a background thread.')
    	, ('XE_BUFFERMGR_FREEBUF_EVENT', 'Occurs when either of the following conditions is true: 1) An Extended Events session is configured for no event loss, and all buffers in the session are currently full. This can indicate that the buffers for an Extended Events session are too small, or should be partitioned. 2) Audits experience a delay. This can indicate a disk bottleneck on the drive where the audits are written.')
    	, ('XE_DISPATCHER_CONFIG_SESSION_LIST', 'Occurs when an Extended Events session that is using asynchronous targets is started or stopped. This wait indicates either of the following 1) An Extended Events session is registering with a background thread pool. 2) The background thread pool is calculating the required number of threads based on current load.')
    	, ('XE_DISPATCHER_JOIN', 'Occurs when a background thread that is used for Extended Events sessions is terminating.')
    	, ('XE_DISPATCHER_WAIT', 'Occurs when a background thread that is used for Extended Events sessions is waiting for event buffers to process.')
    	, ('XE_MODULEMGR_SYNC', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('XE_OLS_LOCK', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('XE_PACKAGE_LOCK_BACKOFF', 'Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FT_COMPROWSET_RWLOCK', 'Full-text is waiting on fragment metadata operation. Documented for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FT_IFTS_RWLOCK', 'Full-text is waiting on internal synchronization. Documented for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FT_IFTS_SCHEDULER_IDLE_WAIT', 'Full-text scheduler sleep wait type. The scheduler is idle.')
    	, ('FT_IFTSHC_MUTEX', 'Full-text is waiting on an fdhost control operation. Documented for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FT_IFTSISM_MUTEX', 'Full-text is waiting on communication operation. Documented for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    	, ('FT_MASTER_MERGE', 'Full-text is waiting on master merge operation. Documented for informational purposes only. Not supported. Future compatibility is not guaranteed.')
    END
     
    SELECT	wait_type
    	, wait_time_ms / 1000.0 AS wait_time_s
    	, 100.0 * wait_time_ms / SUM(wait_time_ms) OVER() AS pct
    	, ROW_NUMBER() OVER(ORDER BY wait_time_ms DESC) AS n
    INTO	#WAIT_1
    FROM	sys.dm_os_wait_stats
    WHERE	wait_type NOT IN
    (
    	'CLR_SEMAPHORE', 'LAZYWRITER_SLEEP', 'RESOURCE_QUEUE', 'SLEEP_TASK',
    	'SLEEP_SYSTEMTASK', 'SQLTRACE_BUFFER_FLUSH', 'WAITFOR', 'LOGMGR_QUEUE',
    	'CHECKPOINT_QUEUE', 'REQUEST_FOR_DEADLOCK_SEARCH', 'XE_TIMER_EVENT', 'BROKER_TO_FLUSH',
    	'BROKER_TASK_STOP', 'CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT', 'DISPATCHER_QUEUE_SEMAPHORE',
    	'FT_IFTS_SCHEDULER_IDLE_WAIT', 'XE_DISPATCHER_WAIT', 'XE_DISPATCHER_JOIN', 'BROKER_EVENTHANDLER',
    	'TRACEWRITE', 'FT_IFTSHC_MUTEX', 'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
    	'BROKER_RECEIVE_WAITFOR', 'ONDEMAND_TASK_QUEUE', 'DBMIRROR_EVENTS_QUEUE',
    	'DBMIRRORING_CMD', 'BROKER_TRANSMITTER', 'SQLTRACE_WAIT_ENTRIES',
    	'SLEEP_BPOOL_FLUSH', 'SQLTRACE_LOCK'
    )
     
    WAITFOR DELAY @delay_length
     
    SELECT	wait_type
    	, wait_time_ms / 1000.0 AS wait_time_s
    	, 100.0 * wait_time_ms / SUM(wait_time_ms) OVER() AS pct
    	, ROW_NUMBER() OVER(ORDER BY wait_time_ms DESC) AS n
    INTO	#WAIT_2
    FROM	sys.dm_os_wait_stats
    WHERE	wait_type NOT IN
    (
    	'CLR_SEMAPHORE', 'LAZYWRITER_SLEEP', 'RESOURCE_QUEUE', 'SLEEP_TASK',
    	'SLEEP_SYSTEMTASK', 'SQLTRACE_BUFFER_FLUSH', 'WAITFOR', 'LOGMGR_QUEUE',
    	'CHECKPOINT_QUEUE', 'REQUEST_FOR_DEADLOCK_SEARCH', 'XE_TIMER_EVENT', 'BROKER_TO_FLUSH',
    	'BROKER_TASK_STOP', 'CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT', 'DISPATCHER_QUEUE_SEMAPHORE',
    	'FT_IFTS_SCHEDULER_IDLE_WAIT', 'XE_DISPATCHER_WAIT', 'XE_DISPATCHER_JOIN', 'BROKER_EVENTHANDLER',
    	'TRACEWRITE', 'FT_IFTSHC_MUTEX', 'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
    	'BROKER_RECEIVE_WAITFOR', 'ONDEMAND_TASK_QUEUE', 'DBMIRROR_EVENTS_QUEUE',
    	'DBMIRRORING_CMD', 'BROKER_TRANSMITTER', 'SQLTRACE_WAIT_ENTRIES',
    	'SLEEP_BPOOL_FLUSH', 'SQLTRACE_LOCK'
    )
     
    SELECT		W1.wait_type
    		, W2.wait_time_s - W1.wait_time_s AS wait_time_s
    		, WD.description
    FROM		#WAIT_1 AS W1
    INNER JOIN	#WAIT_2 AS W2
    			ON W1.wait_type = W2.wait_type
    INNER JOIN	#WAIT_DESCRIPTION AS WD
    			ON WD.wait_type = W1.wait_type
    ORDER BY	wait_time_s DESC
    En effet, certains types d'attentes sont normaux : ce sont des processus d'arrière plan que le moteur met en attente, et déclenche à intervalles de temps régulier, comme par exemple CHECKPOINT.

    Un autre axe très productif est l'étude du cache de requêtes (sys.dm_exec_query_stats et sys.dm_exec_procedure_stats). Un début d'étude peut être le suivant :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    ;WITH
    	QS AS
    	(
    		SELECT		QS.query_hash
    				, QS.query_plan_hash
    				, QS.creation_time
    				, QS.last_execution_time
    				, QS.plan_handle
    				, QS.plan_generation_num
    				, QS.execution_count
    				---
    				, QS.min_logical_reads
    				, QS.max_logical_reads
    				, QS.total_logical_reads
    				---
    				, QS.min_physical_reads
    				, QS.max_physical_reads
    				, QS.total_physical_reads
    				---
    				, QS.max_worker_time
    				, QS.min_worker_time
    				, QS.total_worker_time
    				---
    				, QS.min_elapsed_time
    				, QS.max_elapsed_time
    				, QS.total_elapsed_time
    				, COALESCE(DB_NAME(ST.dbid), DB_NAME(CAST(PA.value AS int))) AS database_name
    				, SUBSTRING
    				(
    					ST.text
    					, (QS.statement_start_offset / 2) + 1
    					, (
    						(
    							CASE statement_end_offset
    								WHEN -1 THEN DATALENGTH(ST.text)
    								ELSE QS.statement_end_offset
    							END
    							- QS.statement_start_offset
    						) / 2
    					) + 1
    				) AS statement_text
    				, QS.min_rows
    				, QS.max_rows
    				, QS.total_rows
                      FROM		sys.dm_exec_query_stats AS QS
                      CROSS APPLY	sys.dm_exec_sql_text(QS.sql_handle) AS ST
    		  CROSS APPLY	sys.dm_exec_plan_attributes(QS.sql_handle) AS PA
                      WHERE		PA.attribute = 'dbid'
    		  AND		PA.value > 4 -- Exclusion des bases de données système
    	)
    SELECT	database_name
    	, query_hash
    	, query_plan_hash
    	, creation_time
    	, last_execution_time
    	, plan_handle
    	, plan_generation_num
    	, SUM(execution_count) AS exec_count
    	---
    	, MIN(min_logical_reads) AS min_L_IO
    	, SUM(total_logical_reads) / SUM(execution_count) AS avg_L_IO
    	, MAX(max_logical_reads) AS max_L_IO
    	, SUM(total_logical_reads) AS total_L_IO
    	---
    	, MIN(min_physical_reads) AS min_P_IO
    	, SUM(total_physical_reads) / SUM(execution_count) AS avg_P_IO
    	, MAX(max_physical_reads) AS max_P_IO
    	, SUM(total_physical_reads) AS total_P_IO
    	---
    	, MIN(min_worker_time) AS min_CPU_time
    	, SUM(total_worker_time) / SUM(execution_count) AS avg_CPU_time
    	, MAX(max_worker_time) AS max_CPU_time
    	, SUM(total_worker_time) AS total_CPU_time
    	---
    	, MIN(min_elapsed_time) AS min_elapsed_time
    	, SUM(total_elapsed_time) / SUM(execution_count) AS avg_elapsed_time
    	, MAX(max_elapsed_time)AS max_elapsed_time
    	, SUM(total_elapsed_time) AS total_elapsed_time
    	---
    	, MIN(min_rows) AS min_rows
    	, SUM(total_rows) / SUM(execution_count) AS avg_rows
    	, MAX(max_rows)AS max_rows
    	, SUM(total_rows) AS total_rows
    	---
    	, MIN(statement_text) AS statement_text
    FROM	QS
    GROUP	BY database_name, query_hash, query_plan_hash, creation_time
    	, last_execution_time, plan_handle, plan_generation_num
    Vous pouvez aussi démarrer une trace SQL Profiler ou Extended Events, qui va capturer les requêtes les plus consommatrices de ressources ... mais il se peut réellement que ce soit le manque de RAM, le sous-système disque, ou les CPU qui doivent être upgradés. Je ne suis pas consultant, mais je n'ai jamais vu que l'on augmente la capacité de traitement d'un serveur avant d'avoir enquêté sur sa configuration actuelle et la performance des requêtes.
    Tout ça pour vous dire que, comme vous héritez d'une instance, il y a de nombreuses facettes à explorer pour s'assurer de la source d'un problème de performance

    Tous ces éléments sont abordés dans le livre sur SQL Server 2014 dont vous trouverez la référence dans ma signature

    @++

  10. #10
    Membre expérimenté

    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Septembre 2003
    Messages
    733
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2003
    Messages : 733
    Points : 1 668
    Points
    1 668
    Billets dans le blog
    8
    Par défaut
    Citation Envoyé par elsuket Voir le message
    On peut aussi procéder par la prise de deux photos à un intervalle défini, et étudier les différences; en s'aidant de la requête proposée par Paul Randal, on aboutit au lot suivant : ..
    Merci Elsuket pour cette requête SQL, inspirée de Paul Randal.
    Pour celles et ceux qui seraient réticents à la langue de Shakespeare, je me suis permis de rajouter la traduction dans la langue de Molière, et ce, pour chaque type d'attente,
    J'en ai profité pour rajouter également les nouveaux types d'attente apparus à partir de la version SQL Server 2012 et 2014.
    Je propose donc ci-joint en pièce jointe (sys_dm_os_wait_stats_Elsuket_Revision_hmira_01.zip) une nouvelle version de ta requête où les messages apparaissent en anglais et en français dans le texte !
    Beaucoup de nouveaux types d'attente ont été rajoutés en versions SQL Server 2012 et 2014. Je n'ai pas analysé de plus prêt, mais je pense que certains de ces nouveaux types d'attente (SQL Server 2012 et 2014) peuvent être ignorés et donc rajoutés dans la clause NOT IN (...) (?).


    Merci.

    A+
    Fichiers attachés Fichiers attachés
    "Une idée mal écrite est une idée fausse !"
    http://hamid-mira.blogspot.com

  11. #11
    Modérateur

    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Janvier 2005
    Messages
    5 826
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2005
    Messages : 5 826
    Points : 12 371
    Points
    12 371
    Par défaut
    Super, merci !

    Vous devriez mettre cela à disposition sur votre blog ou site par exemple

    @++

  12. #12
    Membre expérimenté

    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Septembre 2003
    Messages
    733
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2003
    Messages : 733
    Points : 1 668
    Points
    1 668
    Billets dans le blog
    8
    Par défaut
    Citation Envoyé par elsuket Voir le message
    Super, merci !
    Vous devriez mettre cela à disposition sur votre blog ou site par exemple
    @++
    C'est à nous de te remercier ; tu es à l'initiative de cette requête ô combien pratique et utile.
    OK, c'est noté, je ne manquerais pas de rédiger un petit billet sur mon blog developpez.com, à propos de cette requête SQL, tout en citant l'auteur initial un certain elsuket , et en mentionnant également le lien vers la présente discussion.

    A+
    "Une idée mal écrite est une idée fausse !"
    http://hamid-mira.blogspot.com

  13. #13
    Modérateur

    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Janvier 2005
    Messages
    5 826
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2005
    Messages : 5 826
    Points : 12 371
    Points
    12 371
    Par défaut
    Merci à toi. N'oublies pas de préciser tout de même que la requête "centrale" a été donnée par Paul Randal de SQL Skills

    @++

Discussions similaires

  1. PERFORMANCE SQL SERVER 2005
    Par aziatedu13 dans le forum MS SQL Server
    Réponses: 24
    Dernier message: 05/02/2009, 09h44
  2. Audit dans sql server 2000
    Par randriamanana dans le forum Administration
    Réponses: 11
    Dernier message: 15/12/2008, 13h26
  3. Performance Sql server
    Par sushi21 dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 13/03/2008, 16h42
  4. performances sql server standard et projet ADP ACCESS?
    Par cbleas dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 27/04/2007, 13h53
  5. Performance SQL Server - lot DTS
    Par arno_web dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 04/01/2006, 14h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo