减少接口表的数量是否能有效提高集成性能?
2013-06-23 22:18
363 查看
系统开发过程中,我们经常遇到这样的问题:接口表的数量越来越多,性能越来越慢。想要提高集成效率,减少接口表的数量是否是一种好的方法了??我们来验证一下:
1. 用test2来模拟接口表
SQL> select count(1) from test2;
COUNT(1)
----------
4980400
2. 查询id=100,看消耗时间以及逻辑读和物理读情况
SQL> select * from test2 where object_id=100;
100 rows selected.
Elapsed: 00:00:00.55
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
23527 consistent gets
16685 physical reads
0 redo size
1775 bytes sent via SQL*Net to client
451 bytes received via SQL*Net from client
8 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
100 rows processed
3. 删除一半的数据
SQL> delete/*+parallel(t 8)*/from test2 where object_id>30000;
2025000 rows deleted.
SQL> select count(1) from test2;
COUNT(1)
----------
2955400
4. 再次查询id=100的数据
SQL> select * from test2 where object_id=100;
100 rows selected.
Elapsed: 00:00:00.69
Statistics
----------------------------------------------------------
164 recursive calls
0 db block gets
23544 consistent gets
21810 physical reads
0 redo size
1775 bytes sent via SQL*Net to client
451 bytes received via SQL*Net from client
8 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
100 rows processed
通过比较可以看到像这种全盘扫描的执行方式,删除数据并不能有效提高执行效率。。。。。。数据显示删除数据后,性能反而更加低下。。。至于扫描同样数量的数据块,为什么删除数据后效率更低,没想明白,求大虾指点。。
1. 用test2来模拟接口表
SQL> select count(1) from test2;
COUNT(1)
----------
4980400
2. 查询id=100,看消耗时间以及逻辑读和物理读情况
SQL> select * from test2 where object_id=100;
100 rows selected.
Elapsed: 00:00:00.55
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
23527 consistent gets
16685 physical reads
0 redo size
1775 bytes sent via SQL*Net to client
451 bytes received via SQL*Net from client
8 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
100 rows processed
3. 删除一半的数据
SQL> delete/*+parallel(t 8)*/from test2 where object_id>30000;
2025000 rows deleted.
SQL> select count(1) from test2;
COUNT(1)
----------
2955400
4. 再次查询id=100的数据
SQL> select * from test2 where object_id=100;
100 rows selected.
Elapsed: 00:00:00.69
Statistics
----------------------------------------------------------
164 recursive calls
0 db block gets
23544 consistent gets
21810 physical reads
0 redo size
1775 bytes sent via SQL*Net to client
451 bytes received via SQL*Net from client
8 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
100 rows processed
通过比较可以看到像这种全盘扫描的执行方式,删除数据并不能有效提高执行效率。。。。。。数据显示删除数据后,性能反而更加低下。。。至于扫描同样数量的数据块,为什么删除数据后效率更低,没想明白,求大虾指点。。
相关文章推荐
- C#提高webService接口调用的性能
- 减少IDES disp+work.exe 进程的个数,以提高系统性能
- Jmeter + Ant + Jenkins 接口/性能测试,持续集成环境搭建
- 提高web性能之--减少http请求
- IIS的内容缓存过期机制实践 有效提高站点性能
- 减少对象的创建提高java性能
- Java 垃圾回收机制(以及怎么减少调用GC,提高性能)
- PayPal为什么从Java迁移到Node.js,性能提高一倍,文件代码减少44%
- C#提高webService接口调用的性能
- 对于大批量赋值功能,使用if判断是否能提高性能
- MySQL 中一个库中表数量是否有限制?一般一个数据库中超过多少个表性能会明显下降?
- 自动化测试与持续集成方案--Jmeter 测试接口及性能
- 减少你的锚文本的数量以提高用户体验
- Java基础:减少对象的创建提高java性能
- [转载]PayPal为什么从Java迁移到Node.js,性能提高一倍,文件代码减少44%
- 使用createDocumentFragment()方法---减少回流,提高性能
- 有效提高ASP.NET性能的十个优化方法
- 使用索引查询是否能提高查询的性能以及索引的优缺点
- Python性能鸡汤,非常有效的提高性能的tips
- 如何提高数据库性能,减少数据库服务器压力瓶颈一两个小方法