We have a very large, very old table with a few hundred columns. Some of the columns are historical and aren't used in any writing client. They are mostly empty (expect in very old records). I want to clean up the DB and get rid of old, unused columns in certain tables.
The problem are all the third party clients that access this DB (reading only). I can't expect all providers to update their clients. As long as they are querying for SELECT * ...
, it doesn't matter. But I expect them to query explicitly (SELECT colA, colB, ...
). Removing colA from the table would result in errors on the client side, obviously.
Now I would like to know which columns are explicitly used by any query statements, so I can remove the unused ones. I guess I could use the query log, analyze it and find explicitly used columns, but:
- We receive a few millions queries per hour.
- Some clients access our DB maybe once a week if at all, some every single second.
That means the query log would have to run for months in a production environment and I don't know if that could/would have any negative impact on the servers or overall performance.
Is there any other, more solid solution? Are my concerns regarding the query log exaggerated? I was hoping that MariaDB/MySQL are storing statistical data somewhere, showing the usage of columns, but I couldn't find anything I need.