如何决定index# Database - 数据库
f*e
1 楼
non-cluster index,每增加一个column,都会让search的cost减少,但是I/D/U的cost
增加。
如何找到这个平衡点呢?
Let's say, I have a table to log client activities.
CREATE TABLE ClientLog
(
UserID INT,
TransID INT,
MachineName NVARCHAR(128)
Time DATETIME
)
UserID and TransID are unique non-clustered index.
When a transaction starts, a log is inserted. When a transaction is closed,
the log is deleted.
Now, I am thinking if I need to create another non-cluster index to include
UserID, TransID and MachineName because most of Delete an
增加。
如何找到这个平衡点呢?
Let's say, I have a table to log client activities.
CREATE TABLE ClientLog
(
UserID INT,
TransID INT,
MachineName NVARCHAR(128)
Time DATETIME
)
UserID and TransID are unique non-clustered index.
When a transaction starts, a log is inserted. When a transaction is closed,
the log is deleted.
Now, I am thinking if I need to create another non-cluster index to include
UserID, TransID and MachineName because most of Delete an