随笔分类 -  Oracle.权衡比较Sql文

摘要:有一张emp722表结构和数据如下: create table emp722( id number(10), f1 nvarchar2(20), f2 nvarchar2(20), f3 nvarchar2(20), f4 nvarchar2(20), primary key(id) ); inse 阅读全文
posted @ 2022-07-22 16:55 逆火狂飙 阅读(274) 评论(0) 推荐(0) 编辑
摘要:【实验环境】 Oracle11g 【实验对象表及数据】 create table test05( id number(10), name nvarchar2(5), primary key(id) ) insert into test05 select rownum, dbms_random.str 阅读全文
posted @ 2022-03-04 15:23 逆火狂飙 阅读(53) 评论(1) 推荐(0) 编辑
摘要:【实验环境】 Oracle11g 【实验对象表及数据】 create table test05( id number(10), name nvarchar2(10), primary key(id) ) 充值: insert into test05 select rownum, dbms_rando 阅读全文
posted @ 2022-03-04 15:02 逆火狂飙 阅读(70) 评论(1) 推荐(0) 编辑
摘要:前篇:https://www.cnblogs.com/heyang78/p/15860075.html 【需求】 目标系统存在三张表,用户表Customer,最大有两百万数据;标记表tag,一开始定为10000个,后来改为1600个;两者的连接表Customer_Tag,这个数据多,最多时为2,00 阅读全文
posted @ 2022-02-04 09:55 逆火狂飙 阅读(47) 评论(0) 推荐(0) 编辑
摘要:需求:某系统将诸多服务器状态定时存到在一张表里,查询时会给出一个时间,要求取出最接近于给定时间,又不可大于的一批记录。 比如,有gp、dws、etl三台服务器,8:00,9:00,10:00,11:00都有记录存储了它们的状态,当给定10:30时,就该取出10:00的那批记录。 存储数据的表结构如下 阅读全文
posted @ 2021-10-22 21:09 逆火狂飙 阅读(336) 评论(0) 推荐(0) 编辑
摘要:有这么一个表: create table emp3( id number(8), name nvarchar2(20), deptname nvarchar2(20), salary number(6), primary key(id) ); 可以这样充值: declare d integer; s 阅读全文
posted @ 2021-10-06 20:07 逆火狂飙 阅读(135) 评论(0) 推荐(0) 编辑
摘要:以下实验版本: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionPL/SQL Release 11.2.0.1.0 - Production 不保证在其它环境也是同样效果。 表结构: create 阅读全文
posted @ 2021-10-05 09:42 逆火狂飙 阅读(37) 评论(0) 推荐(0) 编辑
摘要:让我们先建一个实验表: create table dup( id int, name nvarchar2(5), age int, primary key(id)); 然后塞入一百万数据: insert into dup select rownum, dbms_random.string('*',d 阅读全文
posted @ 2021-09-15 21:44 逆火狂飙 阅读(128) 评论(1) 推荐(0) 编辑
摘要:有这样一张成绩表 CREATE TABLE stu_score ( id int , stu_id int, course_id int, score int, primary key(id) ) 可以这样给它插入实验值: Insert into stu_score select rownum,db 阅读全文
posted @ 2021-09-01 16:17 逆火狂飙 阅读(1014) 评论(0) 推荐(0) 编辑
摘要:在前文 https://www.cnblogs.com/heyang78/p/12079017.html 中,我主要描述了现象,给出了结论,这次试图对过程进行一点思索。 需求:从配送表里,当订单号和配送者一样时,取时间最靠近现在即时间值最大的一条记录。 配送表表结构: create table pe 阅读全文
posted @ 2021-08-31 18:01 逆火狂飙 阅读(129) 评论(0) 推荐(0) 编辑
摘要:有这么一张表: create table hy_testtime( id number(6,0) not null primary key, name nvarchar2(20) not null, utime timestamp(6) ) 如果这样给它充值: insert into hy_test 阅读全文
posted @ 2020-02-25 10:51 逆火狂飙 阅读(587) 评论(0) 推荐(0) 编辑
摘要:工作有个给某表某字段添加一段文本的SQL,目的是隐藏用户信息,因表达两千万行耗时较多,当时觉得设上固定值效率会更高,于是有了下面的比较。 先确认下要进行实验的表规模: SQL> select count(*) from tb_qianwan_final; COUNT(*) 16000000 一千六百 阅读全文
posted @ 2020-02-22 10:23 逆火狂飙 阅读(179) 评论(0) 推荐(0) 编辑
摘要:事先申明下,我的DB环境是Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production,如果与作者环境不同而导致结论差异则另当别论。 该案例做了一个id为varchar类型的两种查询对比,我模拟了一下。 我是 阅读全文
posted @ 2020-01-31 11:25 逆火狂飙 阅读(219) 评论(0) 推荐(0) 编辑
摘要:笔者使用的环境: # 类别 版本 1 操作系统 Win10 2 数据库 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 3 硬件环境 T440p 4 内存 8G 有这样一张表: CREATE T 阅读全文
posted @ 2020-01-25 09:17 逆火狂飙 阅读(272) 评论(4) 推荐(0) 编辑
摘要:有这样一张表: CREATE TABLE tb_sc ( id NUMBER not null primary key, studentid int not null, courseid int not null, score int not null ) 用以下语句给它充值十万条数据: Inser 阅读全文
posted @ 2020-01-24 19:04 逆火狂飙 阅读(847) 评论(0) 推荐(0) 编辑
摘要:笔者使用的环境: # 类别 版本 1 操作系统 Win10 2 数据库 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 3 硬件环境 T440p 4 内存 8G 有这样一张表: CREATE T 阅读全文
posted @ 2020-01-24 12:09 逆火狂飙 阅读(238) 评论(0) 推荐(0) 编辑
摘要:本文是受网文 《一次非常有意思的SQL优化经历:从30248.271s到0.001s》启发而产生的。 网文没讲创建表的数据过程,我帮他给出。 创建科目表及数据: CREATE TABLE tb_course ( id NUMBER not null primary key, name NVARCHA 阅读全文
posted @ 2020-01-21 21:29 逆火狂飙 阅读(393) 评论(0) 推荐(0) 编辑
摘要:开始正题前,先把我的数据库环境列出: # 类别 版本 1 操作系统 Win10 2 数据库 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 3 硬件环境 T440p 下面进入正题 有个员工表em 阅读全文
posted @ 2020-01-19 21:03 逆火狂飙 阅读(1493) 评论(0) 推荐(1) 编辑
摘要:问题:有一张表hy_test,查找其字段name中包含ufo的记录数,下面哪种方案最快? A.select count(*) from hy_test where name like '%ufo%' B.select count(*) from hy_test where instr(name,'u 阅读全文
posted @ 2020-01-06 15:48 逆火狂飙 阅读(802) 评论(0) 推荐(0) 编辑
摘要:SQL性能优化的侧重点之一就是用小表驱动大表,今天我做了一次实验。 硬件环境:T440p 软件环境:Win10 实验数据库:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 实验表:bigtabl 阅读全文
posted @ 2020-01-05 09:58 逆火狂飙 阅读(1153) 评论(0) 推荐(0) 编辑

生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东
点击右上角即可分享
微信分享提示