MariaDB Table Space Show Query
SELECT table_schema, SUM(data_length+index_length) as Byte
|
Using pymysql
import pymysql
conn = pymysql.connect(host=' ', port= , user=' ', password=' ', db=' ',charset='utf8')
c = conn.cursor()
sql = '''
SELECT table_schema, SUM(data_length+index_length) as Byte
FROM information_schema.tables
GROUP BY table_schema
ORDER BY Byte DESC'''
c.execute(sql)
rows = c.fetchall()
for row in rows:
print(row[0],row[1])
---------------------------------------------------------------------------------------
xxxxx 38584320
mysql 756143
information_schema 180224
performance_schema 0
파이썬 pymysql 모듈을 이용한 테이블스페이스 용량 확인.
'Python > Python Programming' 카테고리의 다른 글
[Python] for문에 리스트 순회시 remove가 정상적으로 반영되지 않는 이유 (0) | 2020.05.18 |
---|---|
[Python] PC의 호스트네임(hostname)과 MAC Address 얻기 (0) | 2020.05.14 |
[Python] random 함수 (0) | 2020.05.13 |
Jupyter notebook 간단한 사용법 (0) | 2020.03.07 |
[ Python ] 네이버_API 이용하기 (0) | 2020.01.21 |
[Python] BeautifulSoup의 find와 findAll의 차이 (0) | 2020.01.15 |
[Python] 파이썬을 이용하여 텔레그램(Telegram) 메세지 보내기 (0) | 2020.01.09 |
[ Python ] Convert datetime from Unix Time Stamp. (Unix Time Stamp를 일반 datetime 형식으로 변환) (0) | 2019.12.13 |