暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

GBase 8c 教程(九)索引基础操作

唤溪 2022-01-17
389

1、创建索引——CREATE INDEX语句:
1)查询表:

select * from customer order by id;

返回结果:

id | name | birthday | tel ----+--------+------------+----------- 1 | 刘备 | 2020-04-01 | 123456789 2 | 关羽 | 2020-04-02 | 132456789 3 | 张飞 | 2020-04-03 | 142356789 4 | 曹操 | 2020-04-04 | 154623789 5 | 孙坚 | 2020-04-05 | 145623789 6 | 孙策 | 2020-04-06 | 154687923 7 | 诸葛亮 | 2020-04-07 | 456789123 8 | 周瑜 | | 9 | 黄忠 | | 10 | 陶谦 | | (10 rows)

2)创建索引:

CREATE INDEX customer_id_index ON customer(id);

使用\di命令查看索引情况:

\di
List of relations Schema | Name | Type | Owner | Table --------+-------------------+-------+-------+---------- public | customer_id_index | index | gbase | customer (1 row)

创建成功!

2、删除索引——DROP INDEX语句:
删除命令:

DROP INDEX customer_id_index;

使用\di命令查看索引情况:

Did not find any relations.

删除成功!

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论