What ways are there for discovering (preferably through configuration/external tools rather than application code changes) how many read queries and write queries are performed across all tables in a MySQL database?
I can find slow queries with the slow queries log, and some monitoring tools such as NewRelic offer information on read/write ratios across the whole server, but I need these broken down by database table.
Eventually I settled on using
tcpdumpon the database server to capture all traffic on the MySQL port. I imported this in WireShark, and set preferences in Wireshark to show the SQL query in the ‘info’ column. I then exported this as a CSV fiel, stripped off everything except the query, and wrote a custom Java tool to read the file full of queries line-by-line looking for key terms.It was long winded, but it mostly worked!