ITPub博客

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

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

原创 国内数据库 作者:yhw1809 时间:2024-06-25 18:13:21 0 删除 编辑

数据库管理-第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 ASSELECT 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数据库兼容性进行了测试,测试结果非常优秀。
老规矩,知道写了些啥。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31466763/viewspace-3020144/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2017-06-07

  • 博文量
    383
  • 访问量
    403297