Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to improve the query performance by using indexes?

Status
Not open for further replies.

boligoma

IS-IT--Management
Feb 11, 2003
31
MX
I have this query that is the result of a third-party software:

SELECT DISTINCT D.SucursalTiendas FROM (((HPapiro A
INNER JOIN DGrupo B ON A.CnCveGrupo = B.CnCveGrupo)
INNER JOIN DPapiroNiveles C ON A.CnCveCompania = C.CnCveCompania AND A.Nivel1 = C.CnCveNivelCuentas1 AND A.Nivel2 = C.CnCveNivelCuentas2)
LEFT OUTER JOIN Papiro D ON A.CnCveSucursal = D.CveSucursalTiendas)

The table HPapiro has 2 indexes: one clustered (which is the primary key) and one non-clustered (who has the fields to join DPapiroNiveles) The rest of the tables have only the Primary key index.

The execution plan shows that it consumes 23% of the process by making an index scan on the non-clustered index in HPapiro. And the scan for the primary key takes only 1% of the process.

If I delete the non-clustered index, the execution plan shows a 37% of usuage by scanning the clustered index on HPapiro (the primary key).

I want to improve the time of this query. It takes the same time if I run the query with or without the non-clustered index. How can I can improve the time of this query using indexes?

Thanks,



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top