Madhurima Mishra
Madhurima Mishra

Reputation: 1083

MySQL data type "int" exceeding limits

Using MySQL as a database.We have a table where a column is "int" data type. Its exceeding the limit of int type i.e. 4294967295. Is there any solution to get more entries/values for the same. We don't want to have a downtime for more than an hour.

Changing it to Bigint type has been considered but focus is to lessen the time.

Upvotes: 0

Views: 726

Answers (2)

Priyantha
Priyantha

Reputation: 5083

When your value is long you can't use INT type. You need to change it relevant type. There is more explanation about your problem in StackOverflow

What is the MAX number if I store int(255) in MySQL? Click here

What is the size of column of int(11) in mysql in bytes?Click here

Upvotes: 0

Norbert
Norbert

Reputation: 6084

A solution could be:

  • ALTER TABLE original_table to original_table_old
  • CREATE TABLE with the same layout as the current table but then with a new data type (BIGINT) for the offending column (let's call this one original_table_new)
  • CREATE VIEW original_table AS SELECT * FROM original_table_old UNION SELECT * FROM original_table_new and use that view for your queries.

That is fast, the VIEW could hamper performance pretty much depending on your mysql version (5.7 should be ok).

Upvotes: 1

Related Questions