该用户从未签到
|
沙发
发表于 2015-04-04 11:25:26
|只看该作者
# Use connection pooling. 使用连接池 connection pooling
+ ?1 t: K9 h) t! y" U2 F
- y Z7 L- d) L/ K! E# Choose appropriate isolation levels. 选择合适的隔离级别 d8 k& R1 @' T
3 c9 l8 x2 m/ V0 j# f
# Use Statement pooling. 使用statement pooling% f/ w+ H% d& i3 [) p
{( N8 ^ h5 e; `+ i# Statements versus Prepared Statements: When to Use What? 合适的选用Statement 或者 PreparedStatement
& {. n R0 T3 f9 V; }( a. {5 [% L' ^ L8 J' z6 Z0 o' Y% o+ j
# Tune the SQL to minimize the data returned (e.g. not ‘SELECT *’). 进行SQL调优来减少返回的数据集 比如不使用select *$ w4 v6 J; w- _4 V1 W4 ~" @
# l' S! k: [* b
# Avoid the Usage of Metadata Methods (e.g DatabaseMetaData.getColumns() whenever Possible. They are expensive. 尽可能的避免使用Metadata方法(比如DatabaseMetaData.getColumns())
' J- U/ M( e6 r/ V; l
. b4 V/ c! a7 D7 g" Q# Try to combine queries and batch updates. 合并查询和进行批量更新8 f8 ]$ t2 C9 U' Z+ Q0 f
0 V$ w- U( U R) M2 }
# Use stored procedures.使用存储过程) \! R* I' w1 l8 d# v- P
8 a, e; k2 G0 b6 o* _3 W9 D
# Cache data to avoid repeated queries.对数据进行缓存来避免重复查询4 u- i8 E. D: ~, F+ F4 y
, M/ o" M, D2 ^- G% y7 w
# Close resources (Connections, Statements, ResultSets) when finished with.操作结束时关闭资源(连接,statement, ResultSet等等) |
|