Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » Sybase  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 sybase 关于tempdb的优化
hzxl





发贴: 169
积分: 40
于 2003-08-31 22:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
缺省情况下,tempdb数据库是放置在master设备上,容量为2M,而临时数据库是活动最为平凡的数据库常常被用来排序、创建临时表、重格式化等操作,所以tempdb的优化应该受到特别的关注。

  第一步:将临时数据库与高速缓冲进行绑定。
  由于临时表的创建、使用,临时数据库会频繁地使用数据缓存,所以应为临时数据库创建高速缓存,从而可以使其常驻内存并有助于分散I/O:
  1、创建命名高速缓存
    sp_cacheconfig “tempdb_cache”,”10m”,”mixed”
  2、重新启动server
  3、捆绑临时数据库到tempdb_cache高速缓存
    sp_bindcache “tempdb_cache”, tempdb
  4、若有大的I/O,配置内存池

  第二步:优化临时表
  大多数临时表的使用是简单的,很少需要优化。但需要对临时表进行复杂的访问则、
  应通过使用多个过程或批处理来把表的创建和索引分开。以下两种技术可以改善临时表的优化
  1、在临时表上创建索引
    1)临时表必须存在
    2)统计页必须存在(即不能在空表上创建索引)
  2、把对临时表的复杂的使用分散到多个批处理或过程中,以便为优化器提供信息
    下面的这个过程需要进行优化:
     create proc base_proc
     as
     select * into #huge_result from auths
     select * from article, #huge_result where article.author_code=
     #huge_result.author_code and sex=”0”

  使用两个过程可以得到更好的性能
  1)
    create proc base_proc
    as
    select *
    into #huge_result
    from auths
    exec select_proc

  2)
    create proc select_proc
    as
    select * from article,#huge_result
    where article.author_code=#huge_result.author_code and sex=”0”

  说明:在同一个存储过程或批处理中,创建并使用一个表时,查询优化器无法决定这个表的大小。


hzxl edited on 2003-09-01 15:55

作者 Re:sybase 关于tempdb的优化 [Re:hzxl]
dapan



CJSDN高级会员


发贴: 929
积分: 80
于 2003-09-01 10:19 user profilesend a private message to usersend email to dapansearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Very THX!

简直是一次洗版运动!Big Smile

^_^



作者 Re:sybase 关于tempdb的优化 [Re:hzxl]
hzxl





发贴: 169
积分: 40
于 2003-09-01 15:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
没办法 为了100贴:(


作者 Re:sybase 关于tempdb的优化 [Re:hzxl]
davidself

猫哥

CJSDN高级会员


发贴: 1506
积分: 333
于 2003-09-01 16:29 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hzxl wrote:
没办法 为了100贴:(

^_^,你还挺直接的。



--108的上铺--
davidself@twitter
作者 Re:sybase 关于tempdb的优化 [Re:davidself]
nothing

天外飞仙.....

CJSDN高级会员


发贴: 1636
积分: 131
于 2003-09-01 16:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在sybase 11.0.3上好用么?



躲得过的怪物,躲不过的刺激

作者 Re:sybase 关于tempdb的优化 [Re:hzxl]
emate





发贴: 47
积分: 0
于 2003-09-02 15:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
升级吧,感觉老版本的sybase问题更多 ^_^


作者 Re:sybase 关于tempdb的优化 [Re:hzxl]
emate





发贴: 47
积分: 0
于 2003-11-08 23:12 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
还有一点很重要,
就是将tempd中的所有“段”从master设备上拨出来,
先为tempdb的数据和日志分别建立两个设备,并bind上,

之后,从tempdb段中删除主设备

use tempdb
sp_dropsegment "default", tempdb, master
sp_dropsegment system, tempdb, master
sp_dropsegment logsegment, tempdb, master

PS: sybase区人气不旺呀 !!!




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923