当前位置: 首页 > news >正文

Oracle分析表和索引(analyze)

分析表

analyze table tablename compute statistics;

分析索引

analyze index indexname compute statistics;

该语句生成的统计信息会更新user_tables这个视图的统计信息,分析的结果被Oracle用于基于成本的优化生成更好的查询计划

对于使用CBO(Cost-Base Optimization)很有好处,可以使用更可靠的table信息,从而执行计划也可以更准确一些,在10g会自动analyze,之前的版本需要手动定期

analyze table 一般可以指定分析: 表,所有字段,所有索引字段,所有索引。 若不指定则全部都分析。

SQL> analyze table my_table compute statistics;  SQL> analyze table my_table compute statistics for table for all indexes for all columns;   SQL> analyze table my_table compute statistics for table for all indexes for all indexed columns;其中:SQL> analyze table my_table compute statistics;  等价于:SQL> analyze table my_table compute statistics for table for all indexes for all columns;

sample:

analyze table t1 compute statistics for table;
analyze table t2 compute statistics for all columns;
analyze table t3 compute statistics for all indexed columns;analyze table t5 compute statistics for all indexes; analyze table t4 compute statistics;     (不指定)

另外,可以删除分析数据:

SQL> analyze table my_table delete statistics;SQL> analyze table my_table delete statistics for table for all indexes for all indexed columns;
http://www.lryc.cn/news/390471.html

相关文章:

  • MyBatis踩坑记录-多表关联字段相同,字段数据覆盖问题
  • 昇思25天学习打卡营第6天|数据变换 Transforms
  • 在线JSON可视化工具--改进
  • 探讨命令模式及其应用
  • 1、音视频解封装流程---解复用
  • centos7升级gcc到7.3.0
  • 系统运维面试题总结(网络基础类)
  • PO模式登录测试
  • X86 +PC104+支持WinCE5.0,WinCE6.0,DOS,WinXP, QNX等操作系统,工业控制数据采集核心模块板卡定制
  • 视频监控汇聚和融合平台的特点、功能、接入方式、应用场景
  • 实习总结 --- 其他业务
  • 2024年上半年典型网络攻击事件汇总
  • Ozon、美客多补单测评黑科技:打造无懈可击的自养号补单环境
  • ES报错:解决too_many_clauses: maxClauseCount is set to 1024 报错问题
  • 完全指南:在Linux上安装和精通Conda
  • # linux 系统中,使用 “ ll “ 命令报错 “ bash ll command not found “ 解决方法:
  • 吴恩达深度学习笔记:机器学习策略(2)(ML Strategy (2)) 2.3-2.4
  • 【软件测试】快速定位bug,编写测试用例
  • 升级springboot3
  • 视频编解码从H.264到H.266:浅析GB28181安防视频汇聚EasyCVR视频压缩技术
  • vue项目访问 域名/index.html 空页面问题
  • 区块链开发入门:基础概念与实施技术详解
  • Rust破界:前端革新与Vite重构的深度透视(下)
  • Android 解决 “Module was compiled with an incompatible version of Kotlin“ 问题
  • linux nfs的使用
  • eclipse断点调试(用图说话)
  • vue的学习--day2
  • html + css 快速实现订单详情的布局demo
  • 居然这么简单就能实现扫雷游戏!
  • 安装Gitlab+Jenkins