If you are facing the issue of database error then see here how to fix WordPress database error wp links doesn't exist. I hope you will understand easily and your database also optimizes by this method.