mysql difference between bigint and bigint(20)

mysql, performance

Solution

`BIGINT UNSIGNED` is an eight-byte unsigned integer.

The 20 in BIGINT(20) means almost nothing. It's a hint for display width, it has nothing to do with storage. Practically, it affects only the ZEROFILL option:

CREATE TABLE foo ( bar INT(20) ZEROFILL );
INSERT INTO foo (bar) VALUES (1234);
SELECT bar from foo;

+----------------------+
| bar                  |
+----------------------+
| 00000000000000001234 |
+----------------------+

It's a common source of confusion for MySQL users to see BIGINT(20) and assume it's a size limit, something analogous to CHAR(20).

Problem

I know that signed data type holds negative and positive no's AND unsigned holds only positive integer. But Whats the difference between the two. `bigint unsigned` AND `bigint(20) unsigned`

Original source