表对象的标识

表对象标识

kingbase中表作为数据库对象具有一个系统内部的唯一标识符,这个标识符被称为oid(对象标识符),它是kingbase用来在整个数据集群中唯一地标识每个数据库对象的一个字段。对于表来说,其OID可以在系统目录表sys_class中找到。

oid是否会变化

一般情况下,对表进行dml操作,表的oid是不会发生变化的。但是如果对表进行ddl操作,表oid是否会变化呢?接下来我们测试一下。

复制代码
test=# create table test_oid (id int);
CREATE TABLE
test=# select oid from sys_class where relname ='test_oid' and relkind='r';
  oid
-------
 16390
 test=# alter table test_oid rename TO test_oid_new;
ALTER TABLE
test=# select oid from sys_class where relname ='test_oid_new' and relkind='r';
  oid
-------
 16390
 test=# truncate test_oid_new ;
TRUNCATE TABLE
test=# select oid from sys_class where relname ='test_oid_new' and relkind='r';
  oid
-------
 16390
 test=# drop table test_oid_new ;
DROP TABLE
test=# create table test_oid (id int);
CREATE TABLE
test=# select oid from sys_class where relname ='test_oid' and relkind='r';
  oid
-------
 16395

通过测试,表的oid只有在drop后重建回发生变化,truncate table oid不会改变

mysql 没有类似kingbase oid或pg oid类似的对象标识。

oracle 中表对象的标识由object_id和data_object_id,truncate操作object_id不会发生变化,data_object_id可能会发生变化。

相关推荐
RestCloud1 天前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud1 天前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence1 天前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
DemonAvenger1 天前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥2 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
RestCloud2 天前
揭秘 CDC 技术:让数据库同步快人一步
数据库·api
得物技术2 天前
MySQL单表为何别超2000万行?揭秘B+树与16KB页的生死博弈|得物技术
数据库·后端·mysql
可涵不会debug2 天前
【IoTDB】时序数据库选型指南:工业大数据场景下的技术突围
数据库·时序数据库
ByteBlossom2 天前
MySQL 面试场景题之如何处理 BLOB 和CLOB 数据类型?
数据库·mysql·面试
IvorySQL2 天前
IvorySQL 4.6:DocumentDB+FerretDB 实现 MongoDB 兼容部署指南
postgresql