Indexing your MS SQL Database to improve performance

Hello again!  It’s been a long time since my last publication, but its better late than never.  My topic today is how to improve database performance to make your application efficient.  To be specific, we would be talking about database indexing.

Normally we rely on the Primary Keys as the default index of the table. But in most of our queries we are using other fields which are not Primary Keys, thus resulting to performance issues if we are dealing with large data-sets and codes that contains lambda expressions in a LINQ statement similar to the code below:

Id = cloudDB.CloudMstSymbols.Where(d=>d.Symbol==Price.Symbol).First().Id;

It’s easy to make an index using the SQL Management Studio.  Just right click on the table that you wish to add an index and go to design, click the index icon then add and index using the dialog box provided.  (see image below)

b11

If you can’t use the management studio, e.g., your database resides in the cloud (Windows Azure), you can use Visual Studio and write down the SQL statement similar to the one below:

CREATE NONCLUSTERED INDEX [IX_MstSymbol_Symbol]
    ON [dbo].[MstSymbol]([Symbol] ASC);

That’s it.  Happy coding and if you find this blog helpful, you can make the donation by clicking the Paypal button below.


					
Advertisements
About

Software developer living in the Philippines.

Posted in ASP.NET, Microsoft Access
One comment on “Indexing your MS SQL Database to improve performance
  1. John Eric Magat says:

    A very useful idea 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Author

Harold Glenn P. Minerva
Software Developer / Tech Enthusiast
Living in the Philippines

View Harold Glenn Minerva's profile on LinkedIn

Instagram

Software Engineer - Seasonal and Range Trading Software. Magenta Trader is a powerful stock market visualization software that increases your probability of trading success.

Software Architect and Founder - Easyfis.com is a multi-tenant cloud-based Software-as-a-Service (SaaS) business app that caters to micro, small and medium trading businesses.

CTO and Co-Founder - We give your company the leverage by providing innovative software solutions products such as Point-of-Sales (POS), Financial Information System (FMIS), Payroll and DTR (HRIS), and many more.

%d bloggers like this: