Ceci est un retour d’expérience lorsque j’ai travaillé sur un projet utilisant SQL Server 2000.
Lorsqu’une procédure stockée est créé, le plan d’éxécution n’est pas encore généré mais ce dernier est crée lors du premier appel à la procédure après sa compilation
Ce plan d’éxécution est ensuite stocké en cache et sera réutilisé.
Si la procédure possède des paramètres, lors du premier appel, les paramètres donnés seront pris en compte pour la compilation et la création du plan d’éxécution. Le plan sera donc optimisé par rapport à ces paramètres. C’est ce qu’on appelle « parameters sniffing ». Ce plan ne sera probablement pas optimisé pour d’autre valeur de paramètre.
Dans la plupart des requêtes, ce mécanisme ne pose pas de problème.
Mais lorsque la requête est complexe et que les valeurs ne sont pas bien distribuées sur la colonne filtrée, le « parameters sniffing » ralentit considérablement la procedure stocké du fait de la mauvaise estimation.
Lorsqu’une procédure stockée s’éxécute beacuoup plus lentement qu’une requête à la volée, les deux solutions ci-dessous peuvent être considérées :
1. Recompiler la procédure avant chaque exécution avec le mot clé « with recompile »
Exemple :
create Proc procTest (@pTest int)
with recompile
as
select colTest from tbTest where colTest = @pTest;
2. Utiliser les variables locales
Exemple:
create Proc procTest (@pTest int)
as
declare @varTest int
set @varTest = @pTest
select colTest from tbTest where colTest = @varTest;
vendredi 27 février 2009
dimanche 1 février 2009
Personalized pop-up message dialog box
This is only to refresh memory.
The other day I tried to find how to personalize a pop up message in winforms application.

In fact, I created a new form with a multiline textbox. In the code behind, I added a public method which accepts a string parameter.

The other day I tried to find how to personalize a pop up message in winforms application.
In fact, I created a new form with a multiline textbox. In the code behind, I added a public method which accepts a string parameter.
In the parent form, I called this method with the personalized message as parameter.
mercredi 26 novembre 2008
Browser test
I just received an email from someone about this interesting link :
http://browsershots.org/
You can have a screenshot of a web page shown using different browsers.
Have a nice try.
http://browsershots.org/
You can have a screenshot of a web page shown using different browsers.
Have a nice try.
jeudi 20 novembre 2008
SQL Server 2008
I received by email this link where we can get for free the chapter 1 of e-book version
"Introducing Microsoft SQL Server 2008" by Peter DeBetta, Greg Low, and Mark Whitehorn.
http://csna01.libredigital.com/?urss1q2we6
The chapter 1 talks about the Security and Administration.
You have to sign up to read the full version.
"Introducing Microsoft SQL Server 2008" by Peter DeBetta, Greg Low, and Mark Whitehorn.
http://csna01.libredigital.com/?urss1q2we6
The chapter 1 talks about the Security and Administration.
You have to sign up to read the full version.
Inscription à :
Articles (Atom)