데이터베이스 내 각 테이블 용량 확인(내림차순)
# DataBase/Mysql(MariaDB)2023. 12. 20. 16:06데이터베이스 내 각 테이블 용량 확인(내림차순)

SELECT table_name AS "테이블명", round(((data_length + index_length) / 1024 / 1024), 2) AS "테이블 용량(MB)" FROM information_schema.tables WHERE table_schema = 'your_database_name' ORDER BY (data_length + index_length) DESC;

[mysql]특정DB 전체 테이블 삭제
# DataBase/Mysql(MariaDB)2022. 10. 11. 17:57[mysql]특정DB 전체 테이블 삭제

SET @tables = NULL; SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables FROM information_schema.tables WHERE table_schema = '[DB명]'; SET @tables = CONCAT('DROP TABLE ', @tables); PREPARE stmt FROM @tables; EXECUTE stmt; DEALLOCATE PREPARE stmt; 특정 테이블만 삭제해야할 경우는 조건문에 아래와 같이 추가하면됩니다. AND table_name LIKE '%[테이블명]%'; result SET @tables = NULL > OK > Time: 0.003s SELECT GROUP_CONCAT(tabl..

image