tags:

views:

17

answers:

1

And so that to set UNIQUE for it?

+1  A: 

Use BINARY(16) and store the MD5 hash of the content there:

CREATE TABLE t_content (id INT NOT NULL PRIMARY KEY, content TEXT NOT NULL, hash BINARY(16) NOT NULL, UNIQUE KEY ux_content_hash (hash));

INSERT
INTO    t_content
VALUES  (@content, UNHEX(MD5(@content)));
Quassnoi