| Showing entries 1 to 7 |
There’s a really important difference between a unique index (MySQL’s answer to a “unique constraint”) and a primary key in MySQL. Please take a look at this:
CREATE TABLE `t` (
`a` int,
`b` int,
`c` int,
UNIQUE KEY `a` (`a`,`b`)
)
The combination of columns a, b should uniquely identify any tuple in the table, right?
select * from t;
+------+------+------+
| a | b | c |
+------+------+------+
| 1 | 2 | 3 |
| NULL | NULL | 1 |
| NULL | NULL | 1 |
| NULL | NULL | 1 |
+------+------+------+
Wrong. Our arch-enemy NULL messes things up again:
[Read more...]A UNIQUE index creates a constraint such that all
InnoDB is a transaction-safe, ACID compliant MySQL storage engine. It has commit, rollback, and crash recovery capabilities, and offers row level locking. The engine's overview page explains, “InnoDB has been designed for maximum performance when processing large data volumes. Its CPU efficiency is probably not matched by any other disk-based relational database engine.”
| Showing entries 1 to 7 |