What are the factors you will check for the performane
optimization for a database query?

Answer Posted / samba shiva reddy . m

1.In the select statement give which ever the columns you need
don't give select * from
2.Do not use count()function
3.use indexes and drop indexes regularly it B tree structure we are not going to drop means it will take time for creating indexes it self.
4.when joining the tables use the id's(integer type)not string
5.Sometimes you may have more than one subqueries in your main query. Try to minimize the number of subquery block in your query.
6.Use operator EXISTS, IN and table joins appropriately in your query.
a) Usually IN has the slowest performance.
b) IN is efficient when most of the filter criteria is in the sub-query.
c) EXISTS is efficient when most of the filter criteria is in the main query.
7.Use EXISTS instead of DISTINCT when using joins which involves tables having one-to-many relationship.
8.Try to use UNION ALL in place of UNION.
9.Avoid the 'like' and notlike in where clause.
10.Use non-column expression on one side of the query because it will be processed earlier.
11.To store large binary objects, first place them in the file system and add the file path in the database.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

1 01 101 01010

1550


How to list all user names in a database?

579


What are approximate numeric data types in ms sql server?

577


What are the advantages of using third-party tools?

536


what is the difference between delete table and truncate table commands? : Sql server database administration

509






what method you can use to reduce the overhead of Reporting Services data sources?

145


What is a data source or ds? : sql server analysis services, ssas

548


what is the primary use of the model database? : Sql server administration

494


What is the difference between cube operator and rollup operator? : SQL Server Architecture

608


Explain steps of normalization?

518


Explain different types of index?

579


Explain can you implement data mining in ssrs?

106


How to execute the cursor queries with "open" statements?

599


How you would rewrite the sql query to return the customerid sorted numerically?

562


What is the dbcc command and why is it used?

557