- NEW!
Help answer this question below.
First you need to understand how your database is executing your query. There are database-specific commands for this.
After the result of your analysis comes back, you'll want to make sure index is used as much as possible. Vertical or horizontal partitioning should also be considered. Other things to look for include the design of the database schema and how the database server is configured.
This Query Optimization page has more information on this topic.
I can answer this question for oracle SQL. I am a DBA and this is usually a complex and time consuming area of my job. The first thing to do is run an explain plan of your SQL, if you cannot do this then ask your DBA to help. This contains cost of the query as well as other hints to show what it would typically do if you take the code live. Look for obvious things in the explain plan, such as cartesian join - NOT GOOD - or full table scans where indexes should be used, or index range scans where index to table rowid can be achieved. Learn how to ask for and made proper use of indexes. Learn how to use inner and outer joins, and the use of sub-queries. There is a LOT more to look at but this should give you a good start.
How often do you right-click and "inspect element" while using Google Chrome?
by Random on January 23rd, 2012
| 2 people like this
MICROSOFT EXCEL 2007 FORMULA HELP PLEASE?!
by MLJ on January 29th, 2012
| 1 person likes this
When computers become sentient will they think of engineers as their gods?
by Ombliss22 on January 21st, 2012
| 6 people like this
Which technical documents are common in the Information Technology field?
by johnson.evan11 on January 29th, 2012
| 1 person likes this
How Many Computers Do You Currently Have In Your Home?
by tfranchise2k on January 19th, 2012
| 2 people like this
You're reading What are the first things to look for when optimizing SQL queries?
Comments