易截截图软件、单文件、免安装、纯绿色、仅160KB

sql调优之 寻找我们最感兴趣的语句

Tuning an Application / Reducing Load
If your whole application is performing suboptimally, or if you are attempting to
reduce the overall CPU or I/O load on the database server, then identifying
resource-intensive SQL involves the following steps:
1. Determine which period in the day you would like to examine; typically this is the
application's peak processing time.
2. Gather operating system and Oracle statistics at the beginning and end of that
period. The minimum of Oracle statistics gathered should be file I/O
(V$FILESTAT), system statistics (V$SYSSTAT), and SQL statistics (V$SQLAREA,
V$SQL or V$SQLSTATS, V$SQLTEXT, V$SQL_PLAN, and V$SQL_PLAN_
STATISTICS).
3. Using the data collected in step two, identify the SQL statements using the most
resources. A good way to identify candidate SQL statements is to query
V$SQLSTATS. V$SQLSTATS contains resource usage information for all SQL
statements in the shared pool. The data in V$SQLSTATS should be ordered by
resource usage. The most common resources are:
■ Buffer gets (V$SQLSTATS.BUFFER_GETS, for high CPU using statements)
■ Disk reads (V$SQLSTATS.DISK_READS, for high I/O statements)
■ Sorts (V$SQLSTATS.SORTS, for many sorts)
One method to identify which SQL statements are creating the highest load is to
compare the resources used by a SQL statement to the total amount of that resource
used in the period. For BUFFER_GETS, divide each SQL statement's BUFFER_GETS by
the total number of buffer gets during the period. The total number of buffer gets in
the system is available in the V$SYSSTAT table, for the statistic session logical reads.
Similarly, it is possible to apportion the percentage of disk reads a statement performs
out of the total disk reads performed by the system by dividing V$SQL_STATS.DISK_
READS by the value for the V$SYSSTAT statistic physical reads. The SQL sections of
the Automatic Workload Repository report include this data, so you do not need to
perform the percentag


相关文档:

sql中日期格式

1 ---上个月月初第一天
  2  select CONVERT(varchar(12) , DATEADD(mm,DATEDIFF(mm,0,dateadd(mm,-1,getdate())),0), 112 )
  3
  4  ---上个月月末最后一天
  5  select CONVERT(varchar(12),dateadd(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate()),0)), 112 )
  6
  7 ......

sql having 和where的区别

  最近在学习oracle的时候遇到一个问题,老是弄不清楚where 和having的区别,在网上查一查,感觉还可以,把以下我查的资料推荐给大家。
在select 语句中可以使用group by 子句将行划分成较小的组,然后,使用聚组函数返回每一个组的汇总信息,另外,可以使用having子句限制返回的结果集。group&n ......

SQL命令大全 中英文对照

[code=SQL][/code]
--语 句 功 能 
--数据操作 
SELECT --从数据库表中检索数据行和列 
INSERT --向数据库表添加新数据行 
DELETE --从数据库表中删除数据行 
UPDATE --更新数据库表中的数据 
--数据定义 
CREATE TABLE --创建一个数据库表 
DROP TABLE --从数据 ......

SQL Server CE服务器端和客户端安装配置学习笔记

 
SQL Server 2005 CE开发环境介绍:
       最近学习使用SQL Server 2005 Compact Edition进行数据存储,在学习的过程中发现,使用SQL Server2005 management Studio创建数据库时,在“服务器类型”下拉列表中没有“SQL Server Compact Edition”选项。因为文章 ......

SQL子查询实例

子查询是在一个查询内的查询。子查询的结果被DBMS使用来决定包含这个子查询的高级查询的结果。在子查询的最简单的形式中,子查询呈现在另一条SQL语句的WHERE或HAVING子局内。 
    列出其销售目标超过各个销售人员定额综合的销售点。
SELECT CITY
from OFFICES
WHERE TARGET&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号