Code the query as simply as possible i.e. no unnecessary columns are selected (NOT USE SELECT * FROM TABLENAME) | |
Try to avoid operations on database objects referenced in the WHERE clause (refer analysis of quries in R&D folder) | |
Using a WHERE clause helps reduce overheads in sorting, summing rather than of HAVING clause | |
Minimize the number of table lookups (subquery blocks) in queries | |
Avoid joins that require the DISTINCT qualifier on the SELECT list in queries use EXISTS | |
use union all instead of union | |
Using Anti-join condition with NOT EXIST | |
Put reserved words in upper case and application specific identifiers in lower case | |
Use whitespace inside a control statements | |
Order your declarations consistently by using datatype defined | |
11 | For Formatting Multiline Statements parameters are align in vertically |
Align the remainder of the assignment after the assignment operator (using :) | |
13 | Right-align the reserved word for the clauses against the DML statement |
Don't skimp on the use of line separators | |
The readability of code by adding white space in declaration of variables and assign values. | |
16 | Always use parentheses in expressions containing more than one identifier or literal. . |
Align the IN and OUT keywords in columns for procedure and functions | |
When calling a procedure or function, align the parameters into a column | |
use mixed case for user-defined identifiers | |
Code should always be indented consistently (mutile if..elseif …endif …end) | |
Statements following the WHEN clause of an exception handler should be indented five spaces | |
Spaces should precede and follow character (') literals | |
23 | Do not leave any blank spaces preceding or following the ** operator |
Do not leave blank spaces before or after the plus (+) and minus (-) signs when used as unary operators. | |
Identifiers should always use mixed-case and capital letters to indicate separation of elements within an identifier(vEmployee) | |
The identifiers used for explicitly declared cursors should be meaningful and also %TYPE declaration should include the datatype prefix of the identifer name | |
27 | Do not add redundant bracketting (single if condition) |
Use meaningful abbreviations for table and column aliases |
Thursday, June 24, 2010
optimization technique in sql & pl/sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment