December 18, 2009 at 10:02 am
Is it possible to create nonclustered index on columns with space and ignore the space so that it does not do a table scan?
Thank You
SD Khan
December 18, 2009 at 10:16 am
The table scan occurs if the Engine determines that a table scan will be more efficient. If you have null values or empty strings in your column, they will be included in your non-clustered index if you create it.
You should test the creation of your non-clustered index to determine if the new index will help improve performance. One of the factors to consider is column selectivity and uniqueness of the data in that column. The query that is causing the table-scan may also need to be revised.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 18, 2009 at 10:25 am
What precisely do you mean by "columns with space"?
Columns with lots of nulls?
Columns with lots of empty strings?
Columns that have varchar/nvarchar with leading/trailing spaces?
Something else?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 18, 2009 at 10:31 am
I am not sure what the developer is actually trying to achive so i told him to redo his query.....but is it possible to do teh create index in a way so that it ignores the blank spaces?
I think the problem is there has been new fields added and new data is coming in in the table.
Thank you
December 18, 2009 at 10:35 am
Who designed the tables, the developer? If you post the table DDL, index definitions, sample data and your query, we can help more. Please reference this link to learn how to format your sample content:
http://www.sqlservercentral.com/articles/Best+Practices/61537/"> http://www.sqlservercentral.com/articles/Best+Practices/61537/
December 18, 2009 at 10:52 am
skhan-680833 (12/18/2009)
but is it possible to do teh create index in a way so that it ignores the blank spaces?
What do you mean? What blank spaces where?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 18, 2009 at 10:54 am
GilaMonster (12/18/2009)
skhan-680833 (12/18/2009)
but is it possible to do teh create index in a way so that it ignores the blank spaces?What do you mean? What blank spaces where?
Almost sounds like a filtered index. Unfortunately, not available in SQL Server 2005.
December 18, 2009 at 11:59 am
More information would be needed to best answer the question. As it is, we are only guessing at how best to help/answer your question.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 18, 2009 at 12:05 pm
Thanks everyone. I have asked the developer to redo the query. I do not think filtered index is an option and as it is a vendor apps they build these indexes thourgh the vendor designer tools. Also I checked a few things and I think he should not put indexes on those columns and do the query in a different way. Thank you for all of your help and suggestions.
SD Khan
December 18, 2009 at 12:57 pm
You're welcome.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 19, 2009 at 8:54 am
Never mind... wrong rev...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply