Site sponsored by: Idera Try Idera’s new SQL admin toolset
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share you SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Database Recovery Models in SQL Server
Compare Dates
Filtered Indexes in SQL Server 2008
Importance of Database Backups and Recovery Plan

More     
 
Latest FAQ's

ALTER TABLE SWITCH statement failed because the object '%.*ls' is not ...
ALTER TABLE SWITCH statement failed because column '%.*ls' at ordinal %d ...
ALTER TABLE SWITCH statement failed because table '%.*ls' has %d columns ...
SQL Server Reporting Server (SSRS) service is failing to start ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> performance tuning >> Eliminación de Índices no Usados

Eliminación de Índices no Usados

By : Luis Martin
Mar 30, 2005

Page 3 / 4

Este procedimiento almacenado se ejecuta sin parámetros desde el Analizador de Consultas obteniéndose como salida el informe de los índices no utilizados.

BASE: EJEMPLO

TABLA: [dbo].[APLICACIONES]

INDICES:

    [IXC03.10.31_APLICACIONES_NroTrans]

TABLA: [dbo].[AWItemsAcumHistoricos]

INDICES:

    [IX_AWItemsAcumHistoricosFecha]

    [IX_AWItemsAcumHistoricosItem]

    [IXC_AWItemsAcumHistoricos_Fecha_CodItm]

TABLA: [dbo].[CAJASREG]

INDICES:

    [IXCP04.01.16_CAJASREG_CodCaj2_NroTrans]

TABLA: [dbo].[CHEQUES]

INDICES:

[IXC04.01.09_CHEQUES_FechaVto]

[IXCP04.01.16_CHEQUES_CodCtacte _NroTrans_Secuencia_NroTransegr_Tipo_Directo]

De la misma forma podemos encontrar  los índices usados, mediante el siguiente procedimiento almacenado:

CREATE PROCEDURE Indices_Usados AS

declare

@Base varchar(15),

@Tabla varchar(50),

@Indice varchar(100),

@BaseAnt varchar(15),

@TablaAnt varchar(50),

@Uso varchar(50)

declare IndicesUsados cursor for

 select Base, Tabla, Indice, convert(varchar,max(convert(money,replace(Uso,',','.'))))as Uso

  from Analisis

  where Indice like '[[]IX%'

  group by Base, Tabla, Indice

  having sum(convert(money,replace(Uso,',','.'))) > 0

Order by Base,Tabla,convert(varchar,max(convert(money,replace(Uso,',','.')))) desc,Indice

open IndicesUsados

fetch next from IndicesUsados into @Base, @Tabla, @Indice,@Uso

while (@@FETCH_STATUS <> -1)

begin

  if @Base <> @BaseAnt

     begin   

   Print 'BASE: ' + @Base

   select @BaseAnt = @Base

   select @TablaAnt = ''

     end    

     if @Tabla <> @TablaAnt

     begin   

   Print 'TABLA: ' + @Tabla

   Print 'INDICES: '

   select @TablaAnt = @Tabla

     end


<< Prev Page     Next Page>>    








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved