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

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.

删除成功!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值