Sybase开发的just do it和far away fro
作者:
扁圆柱体 | 来源:发表于
2015-07-21 12:36 被阅读42次
YES - Just Do It
Design
- Should exist unique index for replication table.
- Object name must be same as file name(*.sp).
- Know which DB to put new object, CIS, DW_PROD or MySQL.
- Know which DB design guideline should be covered in new object.
- Know how is new table maintained. GUI, Q-Gen, Cron or others.
- Know whether new table need replication.
- Know how to maintain or archive the history data for new table.
- Name new object(table, colum, index, lock and PK/FK etc.) under naming convention.
Develop
- Know process IO limit on CORP(1M) and DWS(5M)
- Tempdb is is only as your last resort.
- Code under SQL 92 standard.
- Use 'Poor Man's T-SQL Formatter' to format whole code instead of changed pieces.
- Use 'UNION' statement, or #temp table instead of big 'OR' statement.
- Use function % on loop column.
- Introduce an identity column if while-loop is on a #temp table.
- Prefix with 'adhoc_' and add ad-hoc# column on temperary table in Ad-hoc.
- Put the filter conditions on the outer table to 'ON' clause in outer join case.
- Remove unnecessary table join.
- Use #temp or perm temporary table to keep intermediate data.
- Use having clause to filter conditions after the aggregation takes place.
- Don't use rowcount setting if exist trigger.
Deploy
- Know which database and server is affected in your Ad-hoc.
- Know what rows are affected in your Ad-hoc.
- Know whether table you mention in your Ad-hoc is hot.
- Know whether table you mention in your Ad-hoc has trigger.
- Know which target server should be deployed.
- Know what dependency exist in new object.
- Submit separate DDLs for schema change.
- Add 'grant right' statements in procedure deployed to DWS.
- Know our IT process regarding JDDL.
NO - Far Away From
Design
- Don't use smallint type in table design.
- Don't add clustered index on identity column.
- Don't allow null on unique and clustered index keys.
- Don't name table and column with 'rs_xxx'.
- Don't include 'sp' in the object name.
- Don't design one procedure which is called more frequency.
- Don't design new object whose function can be found in existed procedure.
- Don't change table schema before evaluating impact.
Develop
- Don't create long DB transaction.
- Don't create large SQL text.
- Don't bring table scan in show plan for large table such as order_header and order_detail.
- Don't exist infinite while-loop.
- Don't use too many temp table and useless indexes.
- Don't create too many #temp table in procedure.
- Don't operate #temp table frequently such as insert or delete.
- Don't use '<> null' or '= null'.
- Don't abuse while -loop.
- Don't loop column without step-one-increase character such as sku#.
- Don't change any CIS data in DW_PROD procedure.
- Don't add 'go' statement in procedure body.
- Don't function on index keys in where clause.
- Don't mix min() and max() function on an indexed column in one statement.
- Don't create index on #temp table in a perf-sensitive and hot procedure.
本文标题:Sybase开发的just do it和far away fro
本文链接:https://www.haomeiwen.com/subject/xtypqttx.html
网友评论