[Tutorial] How to automatically optimize all database tables via a task
#1
INTRODUCTION

If you are not familiar with database optimization yet, what it does is basically reclaim the space filled by empty spaces in your database. And per Everett777's request, I will demonstrate how you can set up a task to automatically optimize all database tables. For the purpose of this tutorial I will set it to run once a week, which should be enough, but feel free to change it to your needs!

TUTORIAL

1. Upload the file attached below to the ./inc/tasks/ directory.

.php   optimizedb.php (Size: 2.44 KB / Downloads: 517)

2. Go to Admin CP > Tools & Maintenance > Task Manager > Add New Task.

3. Enter "Optimize All Database Tables" in Title.

4. Enter "Optimizes all databases tables." in Short Description.

5. Select "optimizedb.php" from Task.

6. Enter "*" in Time: Minutes, Time: Hours and Time: Days of Month. (as it should be by default).

7. Select "Sunday" from Time: Weekdays.

8. Select "Every Month" from Time: Months.

9. Set Enable Logging? and Task enabled? to "Yes".

   

CONCLUSION

After setting up the task, you will save a lot of space filled by empty spaces that added up during time. And you won't even need to do anything! But if you prefer to do it manually, refer to Malcolm's tutorial which explains what database optimization is, why to do it and how to do it in great detail.
Reply
#2
Very nice faviouz. I've added a link to this thread in my tutorial. Smile
No longer involved in the MyBB project.
Reply
#3
Oh my gosh THANK YOU SO MUCH! You don't know how thatkful I am!
Reply
#4
Thank you
Reply
#5
I am wondering about the comment in line 14
	// Delete moved threads with time limits

There is no deleting involved, right?
Reply
#6
Thanks for this favious, optimizing every week is just... I forget it xD

Thank again Smile
Reply
#7
@linguist: Oops, sorry! I edited it off one of the existing task files and forgot to remove the comment from the other task file. There is no deleting involved whatsoever. I'll re-upload a new file in a moment to avoid more confusions.

For those who have already uploaded it, you can safely ignore it or delete it if you want. Thanks for the feedback guys! Smile
Reply
#8
thanks for the file! this will free up some time of me having to go through the forums I manage and doing it manually.
Reply
#9
@faviouz, thank you man!
Reply
#10
This task doesn't optimize DB with 1.6.6.
DB size before and after this taks the same.
If after task I manually optimize my DB via ACP it became smaller.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)