成都网站建设设计

将想法与焦点和您一起共享

oracle怎么统计分析,oracle 统计

如何在ORACLE系统中对表进行统计分析

begin

成都创新互联公司是一家专业从事成都网站设计、做网站的网络公司。作为专业的建站公司,成都创新互联公司依托的技术实力、以及多年的网站运营经验,为您提供专业的成都网站建设、全网整合营销推广及网站设计开发服务!

dbms_stats.gather_table_stats( ownname='XXXX',tabname = 'XXXX' ,ESTIMATE_PERCENT=100,degree=8, CASCADE=true);

end;

如何分析Oracle

参数说明:

ownname:要分析表的拥有者

tabname:要分析的表名.

partname:分区的名字,只对分区表或分区索引有用.

estimate_percent:采样行的百分比,取值范围[0.000001,100],null为全部分析,不采样. 常量:DBMS_STATS.AUTO_SAMPLE_SIZE是默认值,由oracle决定最佳取采样值.

block_sapmple:是否用块采样代替行采样.

method_opt:决定histograms信息是怎样被统计的.method_opt的取值如下:

for all columns:统计所有列的histograms.

for all indexed columns:统计所有indexed列的histograms.

for all hidden columns:统计你看不到列的histograms

for columns SIZE | REPEAT | AUTO | SKEWONLY:统计指定列的histograms.N的取值范围[1,254]; REPEAT上次统计过的histograms;AUTO由oracle决定N的大小;SKEWONLY multiple end-points with the same value which is what we define by "there is skew in the data

degree:决定并行度.默认值为null.

granularity:Granularity of statistics to collect ,only pertinent if the table is partitioned.

cascace:是收集索引的信息.默认为falase.

stattab指定要存储统计信息的表,statid假如多个表的统计信息存储在同一个stattab中用于进行区分.statown存储统计信息表的拥有者.以上三个参数若不指定,统计信息会直接更新到数据字典.

no_invalidate: Does not invalidate the dependent cursors if set to TRUE. The procedure invalidates the dependent cursors immediately if set to FALSE.

force:即使表锁住了也收集统计信息.

例子:

execute dbms_stats.gather_table_stats(ownname = 'owner',tabname = 'table_name' ,estimate_percent = null ,method_opt = 'for all indexed columns' ,cascade = true);

怎么在oracle数据库中想统计一个用户下所有表的记录的总条数?

analyze table table_name COMPUTE STATISTICS\x0d\x0a对表分析后在使用\x0d\x0aselect count(^) from table_name \x0d\x0a如果你的table_name 有主键 ID\x0d\x0aselect count(ID) from table_name 在统计的时候会用到主键索引

Oracle 数据库的统计功能?比如需要统计某个字段所对应的数据个数,并写入统计表,该如何操作。

用一个过程

create or replace procedure procedure_name as

begin

insert into 统计表

select 字段名1,count(1) from 表 group by 字段名1

--统计表中的字段。(字段名1,数量)。如果有其它字段,请加入到下面select语句中。如:

/* insert into 统计表

select 字段名1,sysdate,'统计者的姓名', count(1) from 表 group by 字段名1*/

end;

如何对一个oracle11gsql语句进行统计分析

可以通过district来取出字段,之后通过count计算总数量。

sql:select count(district id) from tablename;

如果id字段没有空值的话,可以通过count统计字段的总数量(字段内容可能重复)。

sql:select count(id) from tablename;


新闻标题:oracle怎么统计分析,oracle 统计
分享网址:http://chengdu.cdxwcx.cn/article/hegdsp.html