Sybase性能调优建议清单

[color=green][size=medium][url]http://stackoverflow.com/questions/18783/favourite-performance-tuning-tricks[/url]
Here is the handy-dandy list of things I always give to someone asking me about optimisation.
We mainly use Sybase, but most of the advice will apply across the board.

SQL Server, for example, comes with a host of performance monitoring / tuning bits, but if you don't have anything like that (and maybe even if you do) then I would consider the following...

99% of problems I have seen are caused by putting too many tables in a join. The fix for this is to do half the join (with some of the tables) and cache the results in a temporary table. Then do the rest of the query joining on that temporary table.

[b]Query Optimisation Checklist[/b]
[list]
[*]Run UPDATE STATISTICS on the underlying tables
[*]Many systems run this as a scheduled weekly job
[*]Delete records from underlying tables (possibly archive the deleted records)
[*]Consider doing this automatically once a day or once a week.
[*]Rebuild Indexes
[*]Rebuild Tables (bcp data out/in)
[*]Dump / Reload the database (drastic, but might fix corruption)
[*]Build new, more appropriate index
[*]Run DBCC to see if there is possible corruption in the database
[*]Locks / Deadlocks
[*]Ensure no other processes running in database
[*]Especially DBCC
[*]Are you using row or page level locking?
[*]Lock the tables exclusively before starting the query
[*]Check that all processes are accessing tables in the same order
[*]Are indices being used appropriately?
[*]Joins will only use index if both expressions are exactly the same data type
[*]Index will only be used if the first field(s) on the index are matched in the query
[*]Are clustered indices used where appropriate?
[*]range data
[*]WHERE field between value1 and value2
[*]Small Joins are Nice Joins
[*]By default the optimiser will only consider the tables 4 at a time.
[*]This means that in joins with more than 4 tables, it has a good chance of choosing a non-optimal query plan
[*]Break up the Join
[*]Can you break up the join?
[*]Pre-select foreign keys into a temporary table
[*]Do half the join and put results in a temporary table
[*]Are you using the right kind of temporary table?
[*]#temp tables may perform much better than @table variables with large volumes (thousands of rows).
[*]Maintain Summary Tables
[*]Build with triggers on the underlying tables
[*]Build daily / hourly / etc.
[*]Build ad-hoc
[*]Build incrementally or teardown / rebuild
[*]See what the query plan is with SET SHOWPLAN ON
[*]See what’s actually happenning with SET STATS IO ON
[*]Force an index using the pragma: (index: myindex)
[*]Force the table order using SET FORCEPLAN ON
[*]Parameter Sniffing:
[*]Break Stored Procedure into 2
[*]call proc2 from proc1
[*]allows optimiser to choose index in proc2 if @parameter has been changed by proc1
[*]Can you improve your hardware?
[*]What time are you running? Is there a quieter time?
[*]Is Replication Server (or other non-stop process) running? Can you suspend it? Run it eg. hourly?
[/list]
[/size][/color]
第 1 章基础知识简介 .................................................................................... 1 优良性能 .......................................................................................... 1 响应时间 ................................................................................... 1 吞吐量 ....................................................................................... 2 性能设计 ................................................................................... 2 调优性能 .......................................................................................... 3 调优级别 ................................................................................... 4 确定系统限制 ................................................................................... 8 线程、线程池、引擎和 CPU ..................................................... 8 各种逻辑页大小 ........................................................................ 9 列数目和列大小 ........................................................................ 9 表达式、变量和存储过程参数的最大长度 ............................... 10 登录数 ..................................................................................... 10 限制对性能的影响 ................................................................... 10 内核资源内存的大小 ...................................................................... 10 分析性能 ........................................................................................ 11 范式 ........................................................................................ 12 锁定 ........................................................................................ 12 特殊注意事项 .......................................................................... 13 第 2 章网络和性能 ..................................................................................... 15 潜在的性能问题 ............................................................................. 15 关于网络性能的基本问题 ........................................................ 16 技术摘要 ................................................................................. 16 引擎和线程密切连接 ...................................................................... 17 网络监听器 ............................................................................. 17 Adaptive Server 使用网络的方式 .................................................. 18 配置 I/O 控制器 ............................................................................. 18 动态重新配置 I/O 任务 ............................................................ 20 更改网络包大小 ............................................................................. 20 在用户连接中使用大包或缺省包尺寸 ............................................. 21 包的数目至关重要 ................................................................... 21 Adaptive Server 评估工具 ...................................................... 22 其它评估工具 .......................................................................... 22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值