1)SQL 性能提升
select
c.scan_start_time,
a.zh_name,
a.cgi,
b.region_name,
round(round(decode(c.succinitalsetup,0,0,(c.attrelenb-c.attrelenbnormal)/c.succinitalsetup),4),6) Wirelessdrops,
c.attrelenb,
c.attrelenbnormal,
c.succinitalsetup,
round(round(decode(c.nbrattestab,0,0,c.nbrsuccestab/c.nbrattestab)*decode(c.attconnestab,0,0,c.succconnestab/c.attconnestab),4),6) Wirelessconnection,
c.nbrsuccestab,
c.nbrattestab,
c.succconnestab,
c.attconnestab
from tcc_eutrancell a,outer region_city b,outer tpa_eutrancell_ne c
where a.scan_start_time=extend(current,year to day)-1 units day
and c.scan_start_time in (select first_result from tcc_time_snap where first_result >=extend(current,year to day)-1 units day
and first_result <=extend(current,year to day) and time_type=0 and s_hour in (0,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23))
and c.sum_level=0 and c.ne_type=8105 and a.state=1 and a.int_id=c.int_id and
a.city_id=b.city_id;
2)优化的SQL
select
c.scan_start_time,
a.zh_name,
a.cgi,
b.region_name,
round(round(decode(c.succinitalsetup,0,0,(c.attrelenb-c.attrelenbnormal)/c.succinitalsetup),4),6) Wirelessdrops,
c.attrelenb,
c.attrelenbnormal,
c.succinitalsetup,
round(round(decode(c.nbrattestab,0,0,c.nbrsuccestab/c.nbrattestab)*decode(c.attconnestab,0,0,c.succconnestab/c.attconnestab),4),6) Wirelessconnection,
c.nbrsuccestab,
c.nbrattestab,
c.succconnestab,
c.attconnestab
from eutrancell a, region_city b, tpa_eutrancell_ne c
where c.scan_start_time in (
extend(current,year to day)-1 units day || ' 08:00:00',
extend(current,year to day)-1 units day || ' 09:00:00',
extend(current,year to day)-1 units day || ' 10:00:00',
extend(current,year to day)-1 units day || ' 11:00:00',
extend(current,year to day)-1 units day || ' 12:00:00',
extend(current,year to day)-1 units day || ' 13:00:00',
extend(current,year to day)-1 units day || ' 14:00:00',
extend(current,year to day)-1 units day || ' 15:00:00',
extend(current,year to day)-1 units day || ' 16:00:00',
extend(current,year to day)-1 units day || ' 17:00:00',
extend(current,year to day)-1 units day || ' 18:00:00',
extend(current,year to day)-1 units day || ' 19:00:00',
extend(current,year to day)-1 units day || ' 20:00:00',
extend(current,year to day)-1 units day || ' 21:00:00',
extend(current,year to day)-1 units day || ' 22:00:00',
extend(current,year to day)-1 units day || ' 23:00:00'
)
and c.sum_level=0 and c.ne_type=8105 and a.state=1 and a.int_id=c.int_id and a.city_id=b.city_id;
这一次的改进主要在那些方面呀?
1、去掉了外关联
2、去掉了关联快照资源,直接关联的是当天的资源,因为当天的资源表比较小,快照资源表里面数据量很大,取的时候还要确定时间条件,所以取的是当天的
3、取性能表的时间用的是时间截取的写法(之前是关联的我们放时间粒度的一个表,需要做很多关联,所以比较慢)
这个时间截取,可以很多效率吗?
恩,是的,最主要是这个时间截取 取时间的时候,直接把时间写成明确的时间点,比关联取时间点效率高很多
分享到:
相关推荐
PostgreSQL(postgresql-14.2-2-windows-x64.exe),适用于Windows系统:PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象...
postgresql-13.2-1-windows-x64.rar postgresql-13.2-1-windows-x64.rar postgresql-13.2-1-windows-x64.rar postgresql-13.2-1-windows-x64.rar postgresql-13.2-1-windows-x64.rar
postgresql-10.16-2-windows-x64
PostgreSQL(postgresql-14.2-2-osx.dmg),适用于macOS系统:PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型...
PostgreSQL(postgresql-13.5-1-osx.dmg)适用于Mac OS X PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库...
postgresql-9.5.3-1-windows-x64,windows64位版本,安装后自带pgAdmin图形管理工具
postgresql-10.5-2 postgresql-10.5-2-windows-x64.exe postgresql_10.5
postgresql-12.4-1-windows-x64.exe
官方稳定版本 postgresql-9.4.26-1-windows-x64.exe
postgresql-11.8-1-windows-x64-binaries.zip
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现...
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现...
此工具适用于Redhat-6.x、CentOS-6....安装命令:./postgresql-9.4.15-1-linux-x64.run,之后进入图形化界面,可按界面提醒进行一步步操作; 卸载:进入安装目录,运行uninstall-postgresql命令,进入图形化卸载界面。
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现...
postgresql的如下版本postgresql-10.16-1-windows-x64.rar
postgresql-10.21-1-windows-x64.exe安装包
postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-...
jar包文件:postgresql-9.1-901-1.jdbc4.jar javadoc API文档文件:postgresql-9.1-901-1.jdbc4-javadoc.jar sources 源代码文件(若本来存在):postgresql-9.1-901-1.jdbc4-sources.jar 对应Maven信息: ...
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现...
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现...