Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

NC Index Seek 51% and select cost 0%? Expand / Collapse
Author
Message
Posted Monday, July 15, 2013 4:44 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, December 16, 2014 8:55 PM
Points: 1,076, Visits: 3,054
thanks Gail & Chris

Query still there is no problem and working fine....
Post #1473564
Posted Monday, July 15, 2013 4:46 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:43 AM
Points: 6,890, Visits: 14,254
If you find the time to create the index I suggested, I'd be interested in seeing the execution plan

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1473565
Posted Monday, July 15, 2013 5:03 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:43 AM
Points: 6,890, Visits: 14,254
GilaMonster (7/15/2013)
ChrisM@Work (7/15/2013)
Edit - removed RESULTNUMBER, it's the cluster key.


Why? What if someone changes the clustered index?


It won't matter if OP creates the index I suggested. Since it's covering, no key lookup is required - hence no need for the cluster key to be output.


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1473575
Posted Monday, July 15, 2013 5:12 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, December 16, 2014 8:55 PM
Points: 1,076, Visits: 3,054
Hi ChrisM

RESULT Table having 3 NC index and 1 clustred index available already..

if created another one more NC index as you suggested, it will be overlapping on existing one.. pl suggest.


/****** Object: Index [IX_RESULT_SAMPLE_NUMBER] Script Date: 07/15/2013 16:35:47 ******/
CREATE NONCLUSTERED INDEX [IX_RESULT_SAMPLE_NUMBER] ON [dbo].[RESULT]
(
[SAMPLE_NUMBER] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO


/****** Object: Index [IX_RESULT_STATUS] Script Date: 07/15/2013 16:35:55 ******/
CREATE NONCLUSTERED INDEX [IX_RESULT_STATUS] ON [dbo].[RESULT]
(
[STATUS] ASC
)
INCLUDE ( [SAMPLE_NUMBER],
[ANALYSIS],
[NUMERIC_ENTRY],
[UNITS]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

/****** Object: Index [IX_RESULT_TEST_NUMBER] Script Date: 07/15/2013 16:36:13 ******/
CREATE NONCLUSTERED INDEX [IX_RESULT_TEST_NUMBER] ON [dbo].[RESULT]
(
[TEST_NUMBER] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO


/****** Object: Index [PK__RESULT__9AEED70F6CA3E9F7] Script Date: 07/15/2013 16:36:27 ******/
ALTER TABLE [dbo].[RESULT] ADD PRIMARY KEY CLUSTERED
(
[RESULT_NUMBER] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO


Post #1473583
Posted Monday, July 15, 2013 5:23 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:43 AM
Points: 6,890, Visits: 14,254
None of the existing NC indexes are covering.
Create the new index. Change the order of the key columns if necessary.
Then monitor index usage, the cost of maintaining the indexes against the benefit of usage. Ask if you are unsure how to do this.
You may find that queries currently using IX_RESULT_SAMPLE_NUMBER or IX_RESULT_STATUS use the new index instead.


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1473587
Posted Monday, July 15, 2013 5:47 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, December 16, 2014 8:55 PM
Points: 1,076, Visits: 3,054
Hi Chris,

Index created,
CREATE NONCLUSTERED INDEX [IX_VIEW_IP21] ON [dbo].[RESULT] 
(
[SAMPLE_NUMBER] ASC,
[STATUS] ASC,
[ANALYSIS] ASC
)
INCLUDE ( [UNITS],
[NAME],
[NUMERIC_ENTRY]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

But actucal exec.plan high seek 94% which created new index on that table...

could we remove that new index?
thanks





  Post Attachments 
New_Query1.sqlplan (4 views, 81.96 KB)
Post #1473600
Posted Monday, July 15, 2013 6:08 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:43 AM
Points: 6,890, Visits: 14,254
Change the order of the keys - this should give you seeks on [status];

CREATE NONCLUSTERED INDEX [IX_VIEW_IP21] ON [dbo].[RESULT] 
(
[STATUS] ASC,
[SAMPLE_NUMBER] ASC,
[ANALYSIS] ASC
)
INCLUDE ( [UNITS],
[NAME],
[NUMERIC_ENTRY]) WITH (PAD_INDEX = OFF,
STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF,
ONLINE = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO



“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1473609
Posted Monday, July 15, 2013 6:37 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:00 AM
Points: 40,610, Visits: 37,074
ananda.murugesan (7/15/2013)
But actucal exec.plan high seek 94% which created new index on that table...


Why are you fixated on the cost % of the index seek in the plan?



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1473622
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse