The problem seems to be solved, actually I don't know how. We had a problem of electricity, so, the server has switched off, when I run it again I found that the problem has disappeared. I don't know if it was the changes that took a long time to take effect or I had to restart the whole system instead of restarting only mysql. Anyway, I have not optimized the tables yet but I intend to do it before or after the moodle update.
we have two moodle instances installed on this server which explains this number of tables
Thank you very much for your help.