提交 01bc0c33 编写于 作者: Y youxiangyang

元数据查询管理

上级 eb38a39a
# Gbase8s 元数据管理
> 和其他数据库一样,gbase8s把一些配置、表、视图等信息存储到了一些系统表。通过这些系统表,我们可以快速的获取想要的元数据信息。
常用的元数据查询:
- 查询已创建的数据库
- 数据库: `database sysmaster;`
- `select *from sysdatabasesl;`
- sysmaster是一个系统数库
- 查询数据库字符集
- 数据库:database sysmaster;
- select * from sysydbslocale;
- 查询表
- 以下查询均需要切换到要查询的对象所在的数据库进行查询。
- database db_name;
- select tabid,tabname,tabtype from systables where tabid>=100 and tabtype="T" ;
- tabid ,默认需要大于100
- 查询视图
- select * from systables where tabid>=100 and tabtype="V" ;
- 查询列
- select * from syscolumns where tabid="x";
- 查询出来的列的类型,是个代码,需要再关联下其他表
- select * from syscolumnsext where tabid="" order by colno;
- 查询表索引:
- select * from sysindexes where tabid="xxx";
- 查询触发器
- select * from systiggers;
- 查询存储过程
- select * from sysprocedures where procname like "xx_%" ;
- 查询函数: 与查询存储过程一样。
- select * from sysprocedures where procname like 'fn_%';
- 查询同义词
- syssyntable
- 查询约束(主键、外键、唯一索引、null)
- 主键:select * from sysconstraints where constrtype = 'P';
- 约束:select * from sysconstraints where constrtype = 'R';
- 唯一索引:select * from sysconstraints where constrtype = 'U';
- Null:select * from sysconstraints where constrtype="N"
- 查看默认值:
- select * from sysdefaults where tabid="xx"
- 查看数据库空间
- select * from sysdbspaces;
- 查看Chunk
- select * from sysconstraints where constrtype = 'C';
- select * from syschecks where type = 'T' and constrid = <constr_id>;
- select first 3 dbsnum, name, pagesize, fchunk, nchunks, is_temp, is_blobspace, is_sbspace from sysdbspaces;
- 查看VP :
- select * from sysvplst;
- 查看物理日志
- select * from sysplog;
- 查看逻辑日志
- select * from syslogs;
- 查看会话:
- select * from syssessions;
- 查看用户:
- select * from sysusert;
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册