Skip to content

Instantly share code, notes, and snippets.

View samlambert's full-sized avatar

Sam Lambert samlambert

View GitHub Profile
@gplessis
gplessis / auto_increment_capacity.sql
Created June 24, 2014 20:17
Detect AUTO_INCREMENT capacity in MySQL
SELECT table_schema,
table_name,
data_type,
( CASE data_type
WHEN 'tinyint' THEN 255
WHEN 'smallint' THEN 65535
WHEN 'mediumint' THEN 16777215
WHEN 'int' THEN 4294967295
WHEN 'bigint' THEN 18446744073709551615
end >> IF(Locate('unsigned', column_type) > 0, 0, 1) ) AS MAX_VALUE,