Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the maximum size for an index
$database would be the database/schema...
SELECT c.TABLE_NAME, CONSTRAINT_NAME, SUM(CHARACTER_OCTET_LENGTH) AS length FROM KEY_COLUMN_USAGE kcu INNER JOIN COLUMNS c ON c.TABLE_SCHEMA = kcu.TABLE_SCHEMA AND c.TABLE_NAME = kcu.TABLE_NAME AND c.COLUMN_NAME = kcu.COLUMN_NAME WHERE kcu.TABLE_SCHEMA='$database' GROUP BY CONSTRAINT_NAME, c.TABLE_NAME ORDER BY length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.