该用户从未签到
|
沙发
发表于 2015-04-04 11:25:26
|只看该作者
# Use connection pooling. 使用连接池 connection pooling6 D2 F2 {) ?' j# O3 t
" u. F0 D( A- S7 h1 |0 Y
# Choose appropriate isolation levels. 选择合适的隔离级别
' a7 j+ T% b- O% p* h* ?# u2 f* X0 t' V5 h
# Use Statement pooling. 使用statement pooling8 B4 v' U$ x9 _- T
" u5 T4 Q: d- T! _; D9 B- V) `0 k# Statements versus Prepared Statements: When to Use What? 合适的选用Statement 或者 PreparedStatement
! m! g# k7 l$ b/ e- v5 W7 U, e6 z9 K
# Tune the SQL to minimize the data returned (e.g. not ‘SELECT *’). 进行SQL调优来减少返回的数据集 比如不使用select *
4 k) ^9 \" C. V7 z f) a" @! o: q, i: I3 I1 k* A
# Avoid the Usage of Metadata Methods (e.g DatabaseMetaData.getColumns() whenever Possible. They are expensive. 尽可能的避免使用Metadata方法(比如DatabaseMetaData.getColumns())
. A% l7 k/ `& j8 z, W' X/ e' o" s& U! s
# Try to combine queries and batch updates. 合并查询和进行批量更新
" q. ~; u0 q( R& A7 B5 ]5 B( S7 d3 D2 G5 R
# Use stored procedures.使用存储过程+ u. [5 ~% Q9 ?8 `% g" X6 H! ^
1 P3 ?$ s% R7 Y D0 S; {5 o m# Cache data to avoid repeated queries.对数据进行缓存来避免重复查询. u0 S/ g# t; {. }5 |" U
9 n. @/ `8 o7 r1 w. j2 s' z
# Close resources (Connections, Statements, ResultSets) when finished with.操作结束时关闭资源(连接,statement, ResultSet等等) |
|