该用户从未签到
|
沙发
发表于 2015-04-04 11:25:26
|只看该作者
# Use connection pooling. 使用连接池 connection pooling
2 y9 a. L6 S* k; L6 u7 a3 v. e5 G. ]3 o1 T
/ t s: E; v; z8 G9 b# Choose appropriate isolation levels. 选择合适的隔离级别
& _% P7 A: z; z; Y7 x+ h/ g. a5 Y3 ^: ~$ B
# Use Statement pooling. 使用statement pooling, }- e. U: P* @* L
# |8 r7 M: z% _
# Statements versus Prepared Statements: When to Use What? 合适的选用Statement 或者 PreparedStatement; j- J! m1 @; C, {& J$ u& k1 v
& j( S8 @4 b! I# Tune the SQL to minimize the data returned (e.g. not ‘SELECT *’). 进行SQL调优来减少返回的数据集 比如不使用select *
4 p, q4 e0 T7 B4 \' F3 K) l2 H- K/ Q/ Q! l# ?1 D
# Avoid the Usage of Metadata Methods (e.g DatabaseMetaData.getColumns() whenever Possible. They are expensive. 尽可能的避免使用Metadata方法(比如DatabaseMetaData.getColumns())
M( d/ X/ R* Z! p( H( K
& b, T/ O& d( O# Try to combine queries and batch updates. 合并查询和进行批量更新
, z+ ~$ f- M/ H9 X
3 Q3 f# Z& o5 @: s% w+ }) Z: B# Use stored procedures.使用存储过程* X: l' e4 k8 B4 [" ]4 h; C C5 y+ w
9 p* h+ R4 z0 r! j0 F# Cache data to avoid repeated queries.对数据进行缓存来避免重复查询
" j5 P/ n, d* _( _' }3 o, _+ f/ v( _$ ~8 c: g
# Close resources (Connections, Statements, ResultSets) when finished with.操作结束时关闭资源(连接,statement, ResultSet等等) |
|