网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

selectcount(*)fromv$lock查询慢

描述:
select count(*) from v$lock 查询慢 解决方法,具体原因看官方优化文档哈

三都网站建设公司创新互联建站,三都网站设计制作,有大型网站制作公司丰富经验。已为三都近1000家提供企业网站建设服务。企业网站搭建\成都外贸网站制作要多少钱,请找那个售后服务好的三都做网站的公司定做!

SQL> set time on 
00:51:52 SQL> select count(*) from v$lock;

  COUNT(*)
----------
        35
--需要十几秒才能返回结果。

00:55:10 SQL> select /*+ rule */ count(*) from v$lock;

  COUNT(*)
----------
        35

00:55:38 SQL> 

方法1:
添加hint
方法2:
收集统计信息

MOS参考文档
Query Against v$lock Run from OEM Performs Slowly (文档 ID 1328789.1)

搜集统计信息方法如下:
13.2.5 Gathering Statistics for Fixed Objects
Fixed objects are dynamic performance tables and their indexes. These objects record current database activity.
Unlike other database tables, the database does not automatically use dynamic statistics for SQL statement referencing X$ tables when optimizer statistics are missing. Instead, the optimizer uses predefined default values. These defaults may not be representative and could potentially lead to a suboptimal execution plan. Thus, it is important to keep fixed object statistics current.
Oracle Database automatically gathers fixed object statistics as part of automated statistics gathering if they have not been previously collected. You can also manually collect statistics on fixed objects by calling DBMS_STATS.GATHER_FIXED_OBJECTS_STATS. Oracle recommends that you gather statistics when the database has representative activity.

Prerequisites
You must have the SYSDBA or ANALYZE ANY DICTIONARY system privilege to execute this procedure.

To gather schema statistics using GATHER_FIXED_OBJECTS_STATS:
In SQL*Plus or SQL Developer, log in to the database as a user with the necessary privileges.

Example 13-2 Gathering Statistics for a Table
This example uses the DBMS_STATS package to gather fixed object statistics.

BEGIN
  DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
END;
/

See Also:
"Configuring Automatic Optimizer Statistics Collection"
Oracle Database PL/SQL Packages and Types Reference to learn about the GATHER_TABLE_STATS procedure
Parent topic: Gathering Optimizer Statistics Manually

网站名称:selectcount(*)fromv$lock查询慢
当前路径:http://bjjierui.cn/article/pcgpoj.html

其他资讯