• Sponsored Links :

25 SQL Commandments

An article, called 25 SQL Commandments, is a list of tips to help a developer avoid the plague of poorly written SQL statements. The article itself is written for Oracle with some specific Oracle commandments, but a lot of the commandments hold true for SQL Server, too. The 25 SQL Commandments briefly are:

Know your data and business application well.
Test your queries with realistic data.
Write identical SQL statements in your applications.
Use indexes on the tables carefully.
Make an indexed path available.
Use Explain Plan and TKPROF where possible.
Think globally when acting locally.
The WHERE clause is crucial.
Use WHERE instead of HAVING for record filtering.
Specify the leading index columns in WHERE clauses.
Evaluate index scan vs. full table scan.
Use ORDER BY for index scan.
Know thy data.
Know when to use large-table scans.
Minimize table passes.
Join tables in the proper order.
Use index-only searches when possible.
Redundancy is good.
Keep it simple, stupid.
You can reach the same destination in different ways.
Use the special columns.
Use explicit cursors over implicit cursors.
Explore and take advantage of the Oracle parallel query option.
Reduce network traffic and increase throughput.

Refer to full article on : http://www.dbpd.com/vault/9801xtra.htm

aashish's picture