假设我有桌子:
FOO
---
A (PK)
B (PK)
其中A + B是复合主键。
现在假设我想使用自动增量键而不是复合主键
BAR
---
ID (auto-increment PK)
A
B
我正在使用btw语法
Create Index AB_Index on Column (A,B) UNQIUE
如果我需要在BAR上为A + B快速搜索/加入,我就被索引所覆盖。但是如果我需要单独对两列进行快速搜索/连接呢?以下是必要/可取的吗?如果是这样,数据库大小/性能可能会产生什么后果?
Create Index A_Index on Column (A)
Create Index B_Index on Column (B)