Ticket #114 (new defect) — at Initial Version
pg版商品全量索引优化
| Reported by: | huangzhong | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 2012年6.0版本 |
| Component: | 系统相关 | Version: | 6.0 |
| Keywords: | 全量索引优化 | Cc: | |
| Due Date: | 18/09/2012 |
Description
- 背景
商城oracle版建全量索引时是把将近100万条数据(索引用到的所有字段)全部一次性查询得到,虽然减少了访问数据库的次数,但对应用的压力很大,全量索引时间大概是20分钟。
- 优化
上述方式在pg上时报内存溢出,后来采用数据库端游标方式进行分页,每页10万条数据,虽然增大了数据库访问次数,但应用压力变小,全量索引时间是12分钟
con.setAutoCommit(false);
st = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
st.setFetchSize(100000);
String sql = getSelectCProductSql(TYPE_ALL);
ResultSet rs = st.executeQuery(sql);
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/global/2008/images/jss/m_logo091125.jpg)