Indexing Approach for NULL able Column

Hi,

Please share with me your expert on indexing a NULL column with  few data values and others are null.

will this improve the speed of the query

My requirement here is the improve the update process  for a table on a SSIS package for the  NULL values on that table.

thanks
ken hanseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vikas GargAssociate Principal EngineerCommented:
Hello,

Index generally speed up the process of fetching the data and in update it will not.

If your column which is having most nulls is used in join condition or in where clause then it can increase the performance otherwise not.
HuaMin ChenProblem resolverCommented:
Hi,
You have to instead index on other columns which are not null.
Vitor MontalvãoMSSQL Senior EngineerCommented:
You should index columns that has a large variety of values. Columns that like to have mostly the same value shouldn't be indexed. A good example is the Boolean columns (only two values - True or False). Those kind of columns shouldn't be indexed.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Scott PletcherSenior DBACommented:
In that case, I suggest you do index, but limit the index entries to only non-NULL values.  Since most of the values in the table are NULL, indexing on the NULLs wouldn't gain you anything.
ken hanseAuthor Commented:
My requirement is to improved the update statement, that got a where clause to find out "NULL" and update with some values, at the moment it is taking longer to scan through all the null values of the table.

So, it is clear to you my requirement is to improve  the UPDATE query performance.

Eg.

UPDATE table
SET col1 = -1
WHERE col1 is null

I need to improve the performance of this query.
Scott PletcherSenior DBACommented:
You didn't show the query before.  If most of the values are NULL, it will be very difficult to speed up that query.  Good luck with it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ken hanseAuthor Commented:
Thanks for all participant,  it was not enough details to answer from my question.

thanks for every body's contribution.

Thanks ScottPletcher finally  gave conclusion.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.