Forum du laboratoire des technologies Microsoft

Forum du laboratoire des technologies Microsoft

Accéder au contenu

Recherche avancée
  • Raccourcis
    • Sujets sans réponse
    • Sujets actifs
    • Rechercher
    • L’équipe
  • FAQ
  • Connexion
  • Inscription
  • Accueil du forum Applicatifs Microsoft SQL Server
  • Rechercher

Comprendre la différence de performances entre 2 requêtes

Un forum dédié au serveur de Base de Données Made in Microsoft

Modérateurs : Thierry DEMAN (MVP Exchan, ygainche, Modérateurs, Modérateurs_Applicatifs

Règles du forum
Répondre
  • Aperçu avant impression
Recherche avancée
1 message • Page 1 sur 1
j.duchene
N00b
N00b
Messages : 1
Inscription : jeu. 27 juin 2013, 9:35
Comprendre la différence de performances entre 2 requêtes
  • Citer

Message par j.duchene » jeu. 27 juin 2013, 9:50

Bonjour à tous,

Je travaille actuellement sur un projet qui a été créé par un ancien collègue. Le projet tourne sur 2 sites différents. Les serveurs sont quasi identiques:
- même CPU
- même nombre de core dans la VM
- la VM du premier site à 5 Go de RAM et la VM du second à 3 Go RAM
- tous les deux en Windows 2008 R2
- tous les 2 avec SQL Server Express v10.0.2531

Sur le premier site, nous n'avons jamais rencontré de problème de performance.

Sur le deuxième site, j'ai une grosse différence de performance alors que le nombre de record est 3x plus petit.

Code : Tout sélectionner

SELECT @RTempo = (SELECT sum(datediff(mi,CAST('2006-01-01 00:00:00.0000000' AS DateTime2),action_time) * 
	case [action]
		when 2 then 1
		when 1 then -1
		when 14 then -1
		when 13 then 1
		when 11 then -1
		when 12 then 1
	end)
FROM [TableAuditMainDatabase].[dbo].[v_td_tda_tdae]
  where id_casino_day = @jour and id=@table and data_type = 1 and action in (1,2,11,12,13,14)
)
Temps d’exécution: +/- 1 min 30

Pour améliorer les performances, j'ai corrigé la requête comme suit:

Code : Tout sélectionner

SELECT @RTempo = sum(datediff(mi,CAST('2006-01-01 00:00:00.0000000' AS DateTime2),action_time) * 
	case [action]
		when 2 then 1
		when 1 then -1
		when 14 then -1
		when 13 then 1
		when 11 then -1
		when 12 then 1
	end)
FROM [TableAuditMainDatabase].[dbo].[v_td_tda_tdae]
  where id_casino_day = @jour and id=@table and data_type = 1 and action in (1,2,11,12,13,14)
Temps d'éxécution: 1s

Quelqu'un pourrait-il m'expliquer pour j'ai une tel différence de performance juste en changeant l'affectation de la variable?

Merci d'avance.

Bien à vous,

Jérôme
Haut


Répondre
  • Aperçu avant impression
1 message • Page 1 sur 1

Revenir à « SQL Server »

Aller
  • Systèmes Microsoft
  • ↳   Serveurs Windows
  • ↳   Windows 2019
  • ↳   Windows 2016
  • ↳   Windows 2012 Server/2012 R2
  • ↳   Windows 2008 R2 Server
  • ↳   Windows 2008 Server
  • ↳   SBS 2011
  • ↳   SBS/EBS 2008
  • ↳   Clients Windows
  • ↳   Windows 10
  • ↳   Windows 8/8.1
  • ↳   Windows 7
  • ↳   Active Directory
  • ↳   GPO/GPP
  • ↳   Gestion des Utilisateurs (et autres objets AD)
  • ↳   DNS
  • ↳   Controleur de Domaine Et Roles AD
  • ↳   Schema et Réplication
  • ↳   Autres Problèmes AD
  • ↳   Terminal Services
  • ↳   Déploiement des systèmes d'exploitations Windows
  • ↳   Systèmes Windows Non Supportés
  • ↳   Windows Vista
  • ↳   Windows XP
  • ↳   Windows 2000
  • ↳   Autres (Windows NT,Me,98,95,3/2/1, Ms DOS)
  • ↳   SBS 2003
  • ↳   Windows 2003 Server (R2)
  • Applicatifs Microsoft
  • ↳   Microsoft Azure/Office 365/Intune
  • ↳   Exchange Server
  • ↳   Exchange 2016
  • ↳   Exchange 2013
  • ↳   Exchange 2010
  • ↳   Exchange 2007/2003/2000/5.5
  • ↳   Communications Unifiées
  • ↳   SQL Server
  • ↳   Serveur Intranet/Internet
  • ↳   Internet Information serveur (IIS)
  • ↳   Sharepoint
  • ↳   System Center
  • ↳   Suite Microsoft Office
  • ↳   Word
  • ↳   Excel
  • ↳   Outlook
  • ↳   Autres Problèmes Suite Office
  • ↳   Office Info
  • ↳   Edge/Internet Explorer/Windows Mail/Onedrive
  • ↳   Patch/correctifs Ms et Windows Update Service (WSUS)
  • ↳   Serveurs Microsoft
  • ↳   Sécurité
  • Aide Technique
  • ↳   Intéropérabilité avec les Systèmes Alternatifs (Linux, Novell, Mac OS, etc.)
  • ↳   Programmation
  • ↳   Espace Certifications et Formations
  • ↳   Dépannage et Remarques divers
  • ↳   Réseaux et télécommunications
  • ↳   Virtualisation
  • ↳   Microsoft Virtualisation
  • ↳   VMware
  • ↳   Citrix/XEN
  • Divers
  • ↳   Emploi
  • ↳   Achat/Vente informatique
  • ↳   Pause Café
  • ↳   Site Du Forum
  • ↳   Demandes d'info/Modification du forum
  • Accueil du forum
  • Fuseau horaire sur UTC+01:00
  • Supprimer tous les cookies du forum
  • L’équipe
  • Nous contacter

Traduction française officielle © Miles Cellar