PL / SQL statement optimization

  1. When SELECT field, minimize the use of t * such wording, only to write the column name to be queried.;
  2. Multimeter alias multi-table queries, writing specifications, using the AS keyword;
  3. Multi-query conditions where, having mainly on keyword filtering the result of polymerization;
  4. Try right column index calculation operations, such as where sum (a + b)> 3;
  5. When specify your search with more than exist, less in, and and or;
    Reference: SQL statement Daquan SQL performance optimization (constantly sum)
  6. The difference between TRUNCATE and DELETE: TRUNCATE equivalent to empty the table can not be deleted; delete to delete some data to meet the conditions of the rollback before committing the transaction.
  7. Try using capital letters to write SQL, a database to improve recognition speed statement;
  8. ! From the viewpoint of performance improvement, = less, using> or <;
  9. Try not applicable NULL keywords empty judgment; nulls may not allow the design of a database or a default value instead of null values;
  10. Use deduplication rowid; deduplication via the ROWID;
    DELETE FROM person t1
    WHERE t1.rowid > (SELECT MIN(t2.rowid)
                   FROM employees t2
                   WHERE t1.employee_id = t2.employee_id --按照想要唯一保留的字段进行匹配
                 );

11. To use the index columns used in the query.

Guess you like

Origin www.cnblogs.com/snopydog/p/12197128.html