MySQL Error #1071 – Specified key was too long; max key length is 767 bytes

767 bytes in MySQL version 5.6 (and prior versions), is the stated prefix limitation for InnoDB tables. It’s 1,000 bytes long for MyISAM tables. This limit has been increased to 3072 bytes In MySQL version 5.7 (and upwards). You also have to be aware that if you set an index on a big char or varchar field which is utf8mb4 encoded, you have to … Read more

What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

Just to clear up… or sum up… nchar and nvarchar can store Unicode characters. char and varchar cannot store Unicode characters. char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don’t use up all that space. varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar. nchar and nvarchar will take up twice as much storage space, so … Read more

Difference between VARCHAR and TEXT in MySQL

TL;DR TEXT fixed max size of 65535 characters (you cannot limit the max size) takes 2 + c bytes of disk space, where c is the length of the stored string. cannot be (fully) part of an index. One would need to specify a prefix length. VARCHAR(M) variable max size of M characters M needs to be between 1 and 65535 takes … Read more