数据库管理-第213期 HaloDB-Oracle兼容性测试03(20240625)

数据库管理-第213期 HaloDB-Oracle兼容性测试03(20240625)

作者:胖头鱼的鱼缸(尹海文)
Oracle ACE Pro: Database(Oracle与MySQL)
PostgreSQL ACE Partner
10年数据库行业经验,现主要从事数据库服务工作
拥有OCM 11g/12c/19c、MySQL 8.0 OCP、Exadata、CDP等认证
墨天轮MVP、认证技术专家、年度墨力之星,ITPUB认证专家、专家百人团成员,OCM讲师,PolarDB开源社区技术顾问,HaloDB外聘技术顾问,OceanBase观察团成员,青学会MOP技术社区(青年数据库学习互助会)技术顾问
圈内拥有“总监”、“保安”、“国产数据库最大敌人”等称号,非著名社恐(社交恐怖分子)
公众号:胖头鱼的鱼缸;CSDN:胖头鱼的鱼缸(尹海文);墨天轮:胖头鱼的鱼缸;ITPUB:yhw1809。
除授权转载并标明出处外,均为“非法”抄袭

空了两期,今天继续HaloDB-Oracle兼容性测试,这次把之前测试表都清理了。

1 索引

1.1 B-Tree索引

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
CREATE INDEX a_btree ON halo_test (a);

drop table halo_test;

image.png

1.2 Hash索引

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
CREATE INDEX a_hash ON halo_test USING HASH (a);

drop table halo_test;

image.png

1.3 复合索引

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
CREATE INDEX a_cobime ON halo_test (a, b);
select * from pg_indexes where tablename='halo_test'; 

drop table halo_test;

image.png

1.4 唯一索引

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
CREATE UNIQUE INDEX a_unique ON halo_test (a);
select * from pg_indexes where tablename='halo_test'; 

drop table halo_test;

image.png

1.5 表达式索引

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
CREATE INDEX b_expr ON halo_test (trunc(b));

drop table halo_test;

image.png

1.6 部分索引

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
CREATE INDEX b_partial ON halo_test (b) WHERE b >= 10 AND b <= 100;

drop table halo_test;

image.png

2 视图

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
insert into halo_test(b) values(1);
insert into halo_test(b) values(200);
CREATE VIEW v_halo_test AS
SELECT b FROM halo_test WHERE b <= 100;
select * from v_halo_test;

drop view v_halo_test;
drop table halo_test;

image.png

3 表连接

创建测试表:

CREATE TABLE halo_test1 (
a SERIAL,
b NUMERIC
);
CREATE TABLE halo_test2 (
c SERIAL,
d NUMERIC
);
insert into halo_test1 values(1,2);
insert into halo_test1 values(2,2);
insert into halo_test2 values(1,3);
insert into halo_test2 values(3,3);

3.1 内连接

SELECT * FROM halo_test1, halo_test2 WHERE a = c;
SELECT * FROM halo_test1 INNER JOIN halo_test2 ON a = c;

image.png

3.2 左/右外连接

SELECT * FROM halo_test1 LEFT JOIN halo_test2 ON a = c;
SELECT * FROM halo_test1 RIGHT JOIN halo_test2 ON a = c;

image.png

3.3 全连接

SELECT * FROM halo_test1 FULL JOIN halo_test2 ON a = c;

image.png

清理环境:

drop table halo_test1;
drop table halo_test2;

4 聚合函数

CREATE TABLE halo_test (
a SERIAL,
b NUMERIC
);
insert into halo_test(b) values(11);
insert into halo_test(b) values(12);
SELECT max(b) FROM halo_test;

image.png

5 窗口函数

SELECT avg(b) OVER(PARTITION BY b) FROM halo_test;

drop table halo_test;

image.png

总结

本期针对HaloDB的索引、视图、表连接、聚合函数和窗口函数的Oracle数据库兼容性进行了测试,测试结果非常优秀。
老规矩,知道写了些啥。

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

胖头鱼的鱼缸(尹海文)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值