I'm not sure what you are asking, but if it is for a mod that automatically optimizes your database all the time, you should probably rethink that. It isn't good to always optimize (and repair) your database when it is running perfectly fine.
No. Only do it when necessary - like when you are having problems or you change something in the table and need to optimize it (like when you move attachments into the filesystem).