查询复杂sql的表的大小
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,1.先explain plan for 目标sql:explain plan for WITH sales_countries AS (SELECT /*+ gather_plan_statistic
千家信息网最后更新 2025年11月07日查询复杂sql的表的大小
1.先explain plan for 目标sql:
explain plan for WITH sales_countries AS (SELECT /*+ gather_plan_statistics */ cu.cust_id, co.country_name FROM sh.countries co, sh.customers cu WHERE cu.country_id = co.country_id),top_sales AS (SELECT p.prod_name, sc.country_name, s.channel_id, t.calendar_quarter_desc, s.amount_sold, s.quantity_sold FROM sh.sales s JOIN sh.times t ON t.time_id = s.time_id JOIN sh.customers c ON c.cust_id = s.cust_id JOIN sales_countries sc ON sc.cust_id = c.cust_id JOIN sh.products p ON p.prod_id = s.prod_id),sales_rpt AS (SELECT prod_name product, country_name country, channel_id channel, substr(calendar_quarter_desc, 6, 2) quarter, SUM(amount_sold) amount_sold, SUM(quantity_sold) quantity_sold FROM top_sales GROUP BY prod_name, country_name, channel_id, substr(calendar_quarter_desc, 6, 2))SELECT * FROM (SELECT product, channel, quarter, country, quantity_sold FROM sales_rpt) pivot(SUM(quantity_sold) FOR(channel, quarter) IN((5, '02') AS catalog_q2, (4, '01') AS internet_q1, (4, '04') AS internet_q4, (2, '02') AS partners_q2, (9, '03') AS tele_q3)) 46 ORDER BY product, country 47 /Explained.Elapsed: 00:00:00.37
SQL>
2.用以下sql可以查询出相关表的大小:
SELECT owner, segment_name, segment_type, SUM(bytes / 1024 / 1024) "Size(Mb)" FROM dba_segments WHERE owner IN (SELECT /*+ no_unnest */ object_owner FROM plan_table) AND segment_name IN (SELECT /*+ no_unnest */ object_name FROM plan_table) GROUP BY owner, segment_type, segment_nameUNION ----table in the indexSELECT owner, '*' || segment_name, segment_type, SUM(bytes / 1024 / 1024) "Size(Mb)" FROM dba_segments WHERE owner IN (SELECT table_owner FROM dba_indexes WHERE owner IN (SELECT /*+ no_unnest */ object_owner FROM plan_table) AND index_name IN (SELECT /*+ no_unnest */ object_name FROM plan_table)) AND segment_name IN (SELECT /*+ no_unnest */ table_name FROM dba_indexes WHERE owner IN (SELECT /*+ no_unnest */ object_owner FROM plan_table) AND index_name IN (SELECT /*+ no_unnest */ object_name FROM plan_table)) GROUP BY owner, segment_type, segment_name ORDER BY 3, 4;
大小
查询
用以
目标
复杂
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
软件开发是现代服务吗
计算机三级网络技术上级考吗
数据库datejsp输出
青海网络授时模块服务器
网络安全靠大家简单绘画
大数据云数据库厂商及其代表产品
网络安全暨保密工作培训会
我的世界国际版24小时服务器
网络安全九进活动
数据库的一级系统
mysql创建数据库架构
游戏用户账号数据库
税务行业软件开发
sonoluspjsk服务器
dell 服务器管理
数据库设计代码python
mac服务器pro测评
亲朋无法登陆服务器
公安的数据库能不能定位
与网络安全的相关文章
网络安全卫生手抄报
应用程序用什么软件开发
T330服务器不识别U盘
网络安全360招聘
数据库选课号对照表
网络安全专家讲座点评
网络安全审查认证中心王连印
计算机网络技术期末重点
学生网络技术开发价值
网络安全 招股说明书