SQL SERVER – 12 Best Practices for Better Database Performance
SQL Server
I have written 12 best practices below, based on my experience I can say that it can optimize the performance of the database.
1) Store necessary information in the database instead of application structure.
2) Use normalized tables in the database, its better perform a small table update than a large table.
3) Keep primary key of lesser CHARS/ INT. Processing a small width key is easier.
4) Don’t store images in the database, its better store their location into the database and keep them on the system.
5) Keep proper datatypes for the fields, for example if you have to store integer then don’t use DECIMAL.
6) While selecting data from table avoid using wild card *, use proper column names.
7) LILE clause must be used properly, if you know the exact match then don’t use LIKE, its better to use “=”.
8) Using JOIN is better for performance than using SUB QUERIES or NESTED QUERIES.
9) Use stored procedure instead of queries; it is better and performs faster then simple queries.
10) Right INDEXES will improve the speed of operation in the database.
11) Use proper comments for readability as well as guideline for next technician.
12) Write SQL keyword in capital for better readability.