0

不明原因:

CREATE TABLE  `orders_products` (
  `ORDER_ID` int(10) unsigned NOT NULL,
  `PRODUCT_ID` int(10) unsigned NOT NULL,
  `QUANTITY` tinyint(3) unsigned NOT NULL,
  `USER_ID` int(10) unsigned NOT NULL,
  PRIMARY KEY (`ORDER_ID`,`PRODUCT_ID`,`USER_ID`) USING BTREE,
  KEY `FK_orders_products_3` (`USER_ID`),
  KEY `FK_orders_products_2` (`PRODUCT_ID`) USING BTREE,
  CONSTRAINT `FK_orders_products_1` FOREIGN KEY (`ORDER_ID`) REFERENCES `orders` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `FK_orders_products_2` FOREIGN KEY (`PRODUCT_ID`) REFERENCES `products` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `FK_orders_products_3` FOREIGN KEY (`USER_ID`) REFERENCES `users` (`ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

主键和 FK_orders_products_2 得到了 BTREE。怎么知道?SHOW INDEX 和 DESCRIBE TABLE 都没有描述谁使用 BTREE 而谁不使用

4

1 回答 1

0

您可以使用以下方式获取有关密钥的信息

 SHOW KEYS FROM orders_products

该结果集中有一个 INDEX_TYPE 列。

于 2013-02-14T22:31:01.583 回答