该用户从未签到
|
沙发
发表于 2015-04-04 11:25:26
|只看该作者
# Use connection pooling. 使用连接池 connection pooling
& _+ F+ r$ Q" u. N
; x+ \3 _% c4 L+ t8 V- _( z# Choose appropriate isolation levels. 选择合适的隔离级别/ X; C; V* i4 n! j
$ V) r$ M$ G# L: p7 W
# Use Statement pooling. 使用statement pooling! q& I) T3 ]8 _- ]8 _" w. E3 v
7 j6 n7 [4 F; O5 ]7 H; w# H# Statements versus Prepared Statements: When to Use What? 合适的选用Statement 或者 PreparedStatement* O O. j7 z- g
4 H! `; ?% {6 ~: {6 B; r% w, f _
# Tune the SQL to minimize the data returned (e.g. not ‘SELECT *’). 进行SQL调优来减少返回的数据集 比如不使用select *
9 I0 I" T0 D( |4 a6 f# n3 d
1 ~ I Y/ J! z+ H# Avoid the Usage of Metadata Methods (e.g DatabaseMetaData.getColumns() whenever Possible. They are expensive. 尽可能的避免使用Metadata方法(比如DatabaseMetaData.getColumns())3 Q! W' e# Z8 ]8 o4 v
( P$ _6 J7 B, U7 H, u- n0 N$ C0 l# Try to combine queries and batch updates. 合并查询和进行批量更新2 u1 S9 m2 v% V
+ ^) G4 G8 m4 h7 t, W
# Use stored procedures.使用存储过程/ T* S* o+ ?3 M# ], o2 R" k: s
7 v. q7 T: l6 h9 [5 |+ Y; H% x: X7 f
# Cache data to avoid repeated queries.对数据进行缓存来避免重复查询" ~! Q! C9 I2 }) i1 q& a
# M& N. g: q& ^, c0 R7 i# Close resources (Connections, Statements, ResultSets) when finished with.操作结束时关闭资源(连接,statement, ResultSet等等) |
|