SQL Pie Chart MYSQL
I came across this interesting post on ASCII pie charts for MySQL. I thought I’d use our command line tool sqlChart todraw the database pie chart instead.
[raw]
table_name size
rental 2850816
payment 2228224
inventory 376832
film_text 325440
film_actor 278528
film 278528
customer 131072
staff 98304
c:\Program Files (x86)\TimeStored.com\sqlDashboards>sqlchart -s mysql -u root –password=pp -D sakila -e “SELECT *
FROM (SELECT table_name,data_length + index_length AS size FROM information_schema.TABLES WHERE table_schema = ‘sakila’) a
WHERE SIZE IS NOT NULL ORDER BY SIZE DESC LIMIT 8” -o c:\temp\aa\sizes.png -c piechart
c:\temp\aa\sizes.png
[/raw]
Simply changing our mysql command to sqlchart and adding the additional arguments
"-o c:\temp\aa\sizes.png -c piechart"
gives us the following SQL Pie Chart:
Notice because sqlchart’s command line arguments closely resemble the mysql command line options, we can quickly change the calls from querying to graphing.