Created
September 18, 2014 15:40
-
-
Save davewalk/5211e7db094cee5082ca to your computer and use it in GitHub Desktop.
mySQL metadata queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the charset of a table | |
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T, | |
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA | |
WHERE CCSA.collation_name = T.table_collation | |
AND T.table_schema = "schemaname" | |
AND T.table_name = "tablename"; | |
# Get a bunch of details about a table including its collation | |
SHOW TABLE STATUS IN dbname like 'tablename' | |
# Get the list of processes the database is currently running | |
SHOW FULL PROCESSLIST\G | |
# Get a list of indexes for a database | |
select index_name from information_schema.statistics; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment