mysql外键索引
来源:互联网 发布:抓取访客手机号源码 编辑:程序博客网 时间:2024/06/17 21:38
mysql在创建外键的时候会自动添加索引,oracle就不会,这样避免了死锁的产生,提高查询效率
mysql> create table f(id int primary key);
Query OK, 0 rows affected (0.05 sec)
mysql> create table c(id int , foreign key(id) references f(id));
Query OK, 0 rows affected (0.02 sec)
mysql> show index from c;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+--------
-------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_c
omment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+--------
-------+
| c | 1 | id | 1 | id | A | 0 | NULL | NULL | YES | BTREE | |
|
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+--------
-------+
1 row in set (0.00 sec)
mysql> drop index id on c;
ERROR 1553 (HY000): Cannot drop index 'id': needed in a foreign key constraint
mysql>
- mysql索引外键
- mysql外键索引
- MySQL普通索引、唯一索引、主索引、外键索引、复合索引、全文索引的使用
- 关于MySQL 外键索引
- mysql 批量删除索引外键
- mysql:外键相关列必须是索引
- mysql给创建的外键自动建立索引吗?
- MySQL中重复索引和重复外键清理
- MySQL中重复索引和重复外键清理
- MySQL 新建数据库、建立索引、建立外键
- mysql创建外键索引时,出现errno 1005错误
- mysql的主键外键索引的区别
- MySQL索引 聚集索引
- mysql 索引 & 索引类型
- MySQL索引 聚集索引
- mysql 索引 & 索引类型
- mysql索引
- mysql索引
- 用eclipse实现NDK调试常见问题总结
- 竞价推广哪家好?易商在线(武汉)网络技术有限公司
- Vivado自学笔记
- signal学习代码实例(sigaction/signalfd)
- /usr/bin/ld:-lc解决方法
- mysql外键索引
- hi3518e移植wifi模块注意事项
- 杭电(hdu)ACM 1003 Max Sum
- linux中线程如何退出
- 一点一点学架构(四)—Spring.NET错误Cannot Resolve Type……
- JSP基本语法
- 屏蔽用户输入查询通配符‘%’或‘_’
- 去除重复字符并排序
- 用MHA实现mysql自动故障转移