punjabtechnicaluniversity.blogspot.in
Following are tips which will increase your SQl performance :-
3. Try to create indexes on columns that have integer values rather than character values.
4. Clustered indexes are more preferable than nonclustered, if you need to select by a range of values or you need to sort results set with GROUP BY or ORDER BY.
Following are tips which will increase your SQl performance :-
1. Every index increases the time in takes to perform INSERTS, UPDATES and DELETES, so the number of indexes should not be very much. Try to use maximum 4-5 indexes on one table, not more. If you have read-only table, then the number of indexes may be increased.
2. Keep your indexes as narrow as possible. This reduces the size of the index and reduces the number of reads required to read the index.
3. Try to create indexes on columns that have integer values rather than character values.
4. If you create a composite (multi-column) index, the order of the columns in the key are very important. Try to order the columns in the key as to enhance selectivity, with the most selective columns to the leftmost of the key.
5. If you want to join several tables, try to create surrogate integer keys for this purpose and create indexes on their columns.Create surrogate integer primary key (identity for example) if your table will not have many insert operations.
4. Clustered indexes are more preferable than nonclustered, if you need to select by a range of values or you need to sort results set with GROUP BY or ORDER BY.
5. If your application will be performing the same query over and over on the same table, consider creating a covering index on the table.
6. You can use the SQL Server Profiler Create Trace Wizard with "Identify Scans of Large Tables" trace to determine which tables in your database may need indexes. This trace will show which tables are being scanned by queries instead of using an index.
0 comments:
Post a Comment
North India Campus