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 :

Optimisation d'opération RID_lookup dans le plan d’exécution de requéte


Sujet :

Administration SQL Server

  1. #1
    Membre expérimenté

    Homme Profil pro
    Auditeur informatique
    Inscrit en
    Novembre 2014
    Messages
    815
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Auditeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2014
    Messages : 815
    Points : 1 350
    Points
    1 350
    Billets dans le blog
    2
    Par défaut Optimisation d'opération RID_lookup dans le plan d’exécution de requéte
    Bonjour a tous

    C'est quoi la signification d'opération RID_lookup cette dernière me présente un coût de 13% dans le plan d’exécution de mon requête

    A quoi sert cette opération et comment je peux l'optimiser

    ci joint la syntaxe de mon requête
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    select Pt_LIB from produit where pt_num
     in  (select pt_num from mvtfabr  where mf_dmvtdeb in (select max (mf_dmvtdeb) 
     from mvtfabr  where pr_num in ('9338')  
    and mf_trans like '%Embal' and mf_dmvtdeb>='11/11/2014 06:00:00'))
    Ci joint le, script de création du table produit qui présente cette opération
    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
    USE [suivi]
    GO
     
    /****** Object:  Table [dbo].[produit]    Script Date: 11/11/2014 11:44:33 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[produit](
    	[pt_num] [varchar](18) NOT NULL,
    	[pt_idplan] [varchar](6) NULL,
    	[pt_lib] [nvarchar](96) NOT NULL,
    	[pt_lib2] [nvarchar](96) NULL,
    	[lp_num] [varchar](2) NOT NULL,
    	[fp_cod] [varchar](10) NOT NULL,
    	[sp_cod] [varchar](25) NOT NULL,
    	[pt_poids] [float] NULL,
    	[pt_codval] [int] NULL,
    	[pt_coeffinc] [float] NULL,
    	[pt_coutsup] [float] NULL,
    	[pt_coutva] [float] NULL,
    	[pt_createur] [varchar](12) NULL,
    	[pt_crebus] [int] NULL,
    	[pt_dcreat] [datetime] NULL,
    	[pt_devis] [varchar](2) NULL,
    	[pt_dladmin] [int] NULL,
    	[pt_dlalloc] [int] NULL,
    	[pt_dlctrl] [int] NULL,
    	[pt_dlfournis] [int] NULL,
    	[pt_dlobt] [int] NULL,
    	[pt_dlprerupt] [int] NULL,
    	[pt_dlsecu] [int] NULL,
    	[pt_empmag] [varchar](8) NULL,
    	[pt_empprinc] [varchar](8) NULL,
    	[pt_etatart] [varchar](2) NULL,
    	[pt_fantome] [tinyint] NULL,
    	[pt_ipde] [varchar](12) NULL,
    	[pt_ipdf] [varchar](12) NULL,
    	[pt_kconv] [float] NULL,
    	[pt_kperte] [int] NULL,
    	[pt_magasin] [varchar](2) NULL,
    	[pt_mappro] [varchar](2) NULL,
    	[pt_nature] [varchar](2) NULL,
    	[pt_pdp] [bit] NULL,
    	[pt_pmp] [float] NULL,
    	[pt_pua] [float] NULL,
    	[pt_puv] [float] NULL,
    	[pt_qbes6mois] [float] NULL,
    	[pt_qcde] [float] NULL,
    	[pt_qcons] [float] NULL,
    	[pt_qconsval] [float] NULL,
    	[pt_qmultcde] [float] NULL,
    	[pt_qpointcde] [float] NULL,
    	[pt_reffabr] [varchar](255) NULL,
    	[pt_reglapp] [varchar](2) NULL,
    	[pt_stkinv] [float] NULL,
    	[pt_stksecu] [float] NULL,
    	[pt_stock] [float] NULL,
    	[pt_tps] [float] NULL,
    	[pt_ua] [int] NULL,
    	[pt_um] [varchar](5) NULL,
    	[sl_num] [varchar](4) NULL,
    	[ce_num] [int] NULL,
    	[cr_num] [int] NULL,
    	[fs_nentr] [varchar](6) NULL,
    	[fs_netabl] [varchar](3) NULL,
    	[pt_catabc] [varchar](100) NULL,
    	[pt_codsag] [varchar](14) NULL,
    	[tp_cod] [varchar](10) NULL,
    	[tr_id] [varchar](3) NULL,
    	[pt_numSWAP] [varchar](18) NULL,
    	[pt_obs] [varchar](255) NULL,
    	[pt_groupeExpertise] [varchar](50) NULL,
    	[pt_agrement] [varchar](30) NULL,
    	[pt_codeFrs] [varchar](15) NULL,
    	[ct_num] [varchar](15) NULL,
    	[ne_cod] [varchar](20) NULL,
    	[sp_Id] [varchar](6) NULL,
    	[or_cod] [varchar](2) NULL,
    	[mp_cod] [varchar](10) NULL,
    	[pt_specifN01] [numeric](18, 0) NULL,
    	[pt_specifN02] [numeric](18, 0) NULL,
    	[pt_specifN03] [numeric](18, 0) NULL,
    	[pt_specifN04] [numeric](18, 0) NULL,
    	[pt_specifN05] [numeric](18, 0) NULL,
    	[pt_specifN06] [numeric](18, 0) NULL,
    	[pt_specifN07] [numeric](18, 0) NULL,
    	[pt_specifN08] [numeric](18, 0) NULL,
    	[pt_specifN09] [numeric](18, 0) NULL,
    	[pt_specifN10] [numeric](18, 0) NULL,
    	[pt_specifT01] [nvarchar](50) NULL,
    	[pt_specifT02] [nvarchar](50) NULL,
    	[pt_specifT03] [nvarchar](50) NULL,
    	[pt_specifT04] [nvarchar](50) NULL,
    	[pt_specifT05] [nvarchar](50) NULL,
    	[pt_specifT06] [nvarchar](255) NULL,
    	[pt_specifT07] [nvarchar](255) NULL,
    	[pt_specifT08] [nvarchar](255) NULL,
    	[pt_specifT09] [nvarchar](255) NULL,
    	[pt_specifT10] [nvarchar](255) NULL,
    	[pt_importNomenc_Statut] [varchar](5) NULL,
    	[pt_importNomenc_Date] [datetime] NULL,
    	[pt_lieuFab] [varchar](2) NULL,
    	[pt_flasher] [tinyint] NULL,
    	[pt_specifN11] [numeric](18, 0) NULL,
    	[pt_specifN12] [numeric](18, 0) NULL,
    	[pt_specifT11] [nvarchar](255) NULL,
    	[pt_specifT12] [nvarchar](75) NULL,
    	[pt_specifN13] [numeric](18, 0) NULL,
    	[pt_specifT13] [varchar](50) NULL,
    	[pt_specifN14] [numeric](18, 0) NULL,
    	[pt_specifT14] [varchar](50) NULL,
    	[pt_specifN15] [numeric](18, 0) NULL,
    	[pt_specifT15] [varchar](20) NULL,
    	[dn_code] [varchar](4) NULL,
    	[mn_cod] [varchar](4) NULL,
    	[tt_trans] [varchar](4) NULL,
     CONSTRAINT [PK_produit_pt] PRIMARY KEY NONCLUSTERED 
    (
    	[pt_num] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_client] FOREIGN KEY([ct_num])
    REFERENCES [dbo].[client] ([ct_num])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_client]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_division] FOREIGN KEY([dn_code])
    REFERENCES [dbo].[division] ([dn_code])
    ON UPDATE CASCADE
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_division]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_lignProd] FOREIGN KEY([lp_num])
    REFERENCES [dbo].[lignProd] ([lp_num])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_lignProd]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_magasin] FOREIGN KEY([mn_cod])
    REFERENCES [dbo].[magasin] ([mn_cod])
    ON UPDATE CASCADE
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_magasin]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_ModelePdt] FOREIGN KEY([mp_cod])
    REFERENCES [dbo].[modelePdt] ([mp_cod])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_ModelePdt]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_Nomenclature] FOREIGN KEY([ne_cod])
    REFERENCES [dbo].[nomenclature] ([ne_Cod])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_Nomenclature]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_operateur] FOREIGN KEY([or_cod])
    REFERENCES [dbo].[operateur] ([or_cod])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_operateur]
    GO
     
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_sfam_pt] FOREIGN KEY([fp_cod], [sp_cod])
    REFERENCES [dbo].[sFam_pt] ([fp_cod], [sp_cod])
    ON UPDATE CASCADE
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_sfam_pt]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_StatutPdt] FOREIGN KEY([sp_Id])
    REFERENCES [dbo].[statutPdt] ([sp_ID])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_StatutPdt]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_transPistolet] FOREIGN KEY([tt_trans])
    REFERENCES [dbo].[transPistolet] ([tt_Trans])
    ON UPDATE CASCADE
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_transPistolet]
    GO
    ALTER TABLE [dbo].[produit]  WITH CHECK ADD  CONSTRAINT [FK_produit_TypeProd] FOREIGN KEY([tp_cod])
    REFERENCES [dbo].[typeProd] ([tp_cod])
    GO
    ALTER TABLE [dbo].[produit] CHECK CONSTRAINT [FK_produit_TypeProd]
    GO
    ALTER TABLE [dbo].[produit] ADD  CONSTRAINT [DF_produit_pt_fantome]  DEFAULT (0) FOR [pt_fantome]
    GO
    ALTER TABLE [dbo].[produit] ADD  CONSTRAINT [DF_produit_pt_pdp]  DEFAULT (0) FOR [pt_pdp]
    GO
    Images attachées Images attachées  

  2. #2
    Modérateur

    Profil pro
    dba
    Inscrit en
    Janvier 2010
    Messages
    5 643
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : dba

    Informations forums :
    Inscription : Janvier 2010
    Messages : 5 643
    Points : 13 092
    Points
    13 092
    Par défaut
    Bonjour,

    Cela signifie que le moteur utilise un index pour obtenir plus rapidement les lignes qui correspondent à certains critères, mais que l'index seul ne contient pas toutes les données nécessaires pour répondre à la requête. Une fois les lignes identifiées grace à l'index, le moteur doit donc aller chercher les informations manquantes dans la table, c'est le RID_lookup.

    D'après les informations que vous avez fournies, il semble dans votre cas que l'index sur la clef primaire et utilisé afin de trouver rapidement les lignes qui correspondent à la clause IN, mais qu'il doit ensuite aller chercher dans la table la valeur de de la colonne Pt_LIB pour ces lignes.

    Vous pouvez donc inclure cette colonne à votre index (clause INCLUDE), mais comme il s'agit de votre clef primaire, je me demande pourquoi l'index n'est pas cluster (ce qui résoudrait également le problème). y a-t-il y une raison à cela ? je ne vois aucun index cluster sur cette table.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Plot fonction surf dans plusieurs plans
    Par AppleGuy dans le forum MATLAB
    Réponses: 2
    Dernier message: 30/06/2006, 17h59
  2. Requêtes pour tâches périodiques dans un planning
    Par sunvialley dans le forum IHM
    Réponses: 8
    Dernier message: 27/06/2006, 16h38
  3. Calcul de dérivées discretes dans le plan
    Par nickoko dans le forum Algorithmes et structures de données
    Réponses: 54
    Dernier message: 21/06/2006, 14h41
  4. [Conception] Détection d'opérations mathématiques dans un textfield
    Par lynal dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 09/06/2006, 08h20
  5. Représentation d'une sphère dans un plan...
    Par progfou dans le forum Algorithmes et structures de données
    Réponses: 2
    Dernier message: 20/01/2006, 17h05

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