 |
|
 |
|
Next: Database Tuning Advisor recommends index on colum..
|
| Author |
Message |
External

Since: Mar 13, 2006 Posts: 67
|
(Msg. 1) Posted: Mon Dec 22, 2008 5:52 am
Post subject: Database Tuning Advisor recommending index on column not reference Archived from groups: microsoft>public>sqlserver>tools (more info?)
|
|
|
Hi,
I have used the DTA on this query...
SELECT TI.Unit, TI.BusDate, TI.Product, TI.PLU, SUM(TI.RetailPrice) AS
RetailPrice, SUM(TI.Quantity) AS Quantity, UTM.TillMap, MAX(TI.BusDate) AS
LastSold, CC.CostCenterDesc, TI.LineIsVoid
FROM Geography.dbo.CostCentre AS CC
INNER JOIN MS2.dbo.TransactionItems AS TI WITH (NOLOCK)
INNER JOIN MS2.dbo.Transactions AS T WITH (NOLOCK)
INNER JOIN Geography.dbo.UnitTillMaps AS UTM WITH (NOLOCK) ON T.Unit =
UTM.Unit AND T.BusDate >= UTM.StartBusDate AND T.BusDate <= UTM.EndBusDate ON
TI.Unit = T.Unit AND TI.UniqueRef = T.UniqueRef AND TI.POS = T.POS AND
TI.BusDate = T.BusDate ON CC.CostCentreCode = T.Unit
LEFT OUTER JOIN MS2.dbo.Voids AS V WITH (NOLOCK) ON T.Unit = V.Unit AND
T.UniqueRef = V.UniqueRef AND T.POS = V.POS AND T.BusDate = V.BusDate
LEFT OUTER JOIN MS2.dbo.PLUMappings AS PM WITH (NOLOCK) ON UTM.TillMap =
PM.TillMap AND TI.PLU = PM.POSPLU
WHERE (V.Unit IS NULL) AND (PM.TillMap IS NULL)
GROUP BY TI.Unit, TI.BusDate, TI.Product, TI.PLU, UTM.TillMap,
CC.CostCenterDesc, TI.LineIsVoid
HAVING (TI.PLU <> '0') AND (TI.BusDate = '20/12/2008') AND (TI.LineIsVoid
<> 1)
and it is recommending this index...
CREATE NONCLUSTERED INDEX
[_dta_index_TransactionItems_20_948198428__K4_K1_K3_K2_K10_K31_K6_K34_5_13]
ON [dbo].[TransactionItems]
( [BusDate] ASC,
[Unit] ASC,
[POS] ASC,
[UniqueRef] ASC,
[PLU] ASC,
[FuelGrade] ASC,
[Product] ASC,
[LineIsVoid] ASC)
INCLUDE ( [Quantity], [RetailPrice]) WITH (SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]
What I don't understand is why column [FuelGrade] is part of the index as
this column is not used in the query?
Thanks
Paul >> Stay informed about: Database Tuning Advisor recommending index on column not r.. |
|
| Back to top |
|
 |  |
External

Since: May 30, 2004 Posts: 1649
|
(Msg. 2) Posted: Mon Dec 22, 2008 2:59 pm
Post subject: Re: Database Tuning Advisor recommending index on column not reference [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Paul (Paul@discussions.microsoft.com) writes:
> I have used the DTA on this query...
> SELECT TI.Unit, TI.BusDate, TI.Product, TI.PLU, SUM(TI.RetailPrice) AS
> RetailPrice, SUM(TI.Quantity) AS Quantity, UTM.TillMap, MAX(TI.BusDate) AS
> LastSold, CC.CostCenterDesc, TI.LineIsVoid
BusDate is both in a MAX unfunction and also aggregated on? That looks
funny.
> and it is recommending this index...
>
> CREATE NONCLUSTERED INDEX
> [_dta_index_TransactionItems_20_948198428__K4_K1_K3_K2_K10_K31_K6_K34_5_13]
> ON [dbo].[TransactionItems]
> ( [BusDate] ASC,
> [Unit] ASC,
> [POS] ASC,
> [UniqueRef] ASC,
> [PLU] ASC,
> [FuelGrade] ASC,
> [Product] ASC,
> [LineIsVoid] ASC)
> INCLUDE ( [Quantity], [RetailPrice]) WITH (SORT_IN_TEMPDB = OFF,
> IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]
>
> What I don't understand is why column [FuelGrade] is part of the index as
> this column is not used in the query?
Maybe the query has been edited since you ran DTA? In any case, running
DTA for a single query may not always be that great. Unless, that is,
this is a core query of your system. DTA is apparently trying to build
a covering indexes, but if you later add another column to the query,
the index will no longer be covering again. And unless the table is
very wide the effect on the query may be limited, whereas on other hand
it may have an impact on inserts and updates.
--
Erland Sommarskog, SQL Server MVP, esquel.TakeThisOut@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx >> Stay informed about: Database Tuning Advisor recommending index on column not r.. |
|
| Back to top |
|
 |  |
| Related Topics: | Database Engine Tuning Advisor problem - I am trying to the the Database Engine Tuning Advisor in SQL 2005. I start by running a Tuning trace in SQL profiler and saving it to a file. Next I load the trace file into the Advisor for analysis. I get the following error in the log of the advisor...
Partition recommendation in the Database Engine Tuning Adv.. - Hello, I have some problems with Database Engine Tuning Advisor. I can't find any partition recommendation. 1) I created a table containing two columns (int and char(16)) and filled it with simple data: 1, 'string' .... 2, 'string' .... 3, 'string'..
Error using Db Engine Tuning Advisor - I am running SQL 2005 Standard, obtained from a recent Launch event. I got the Database Engine Tuning Advisor to run only once. Everytime after that I get a runtime error: "R6031 Attempt to initialize the CRT more than once. This indicates a bug ...
New server: the tuning advisor don't consume the worjload... - Hi, I have just installed a new server, and like another one the database tuning advisor don't do its job! the consuming workload and performing steps still at 0% for 1 hour (which is the default timeout value) I do it against a simple select * from....
2005 DB Engine Tuning Advisor Error - Hi, Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 2) For many valid table names, the Tuning Advisor gives this.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|