How to Effectively Clean Your Elgg Database
The Elgg database is a bit complex as compared to other popular CMS like WordPress and Joomla. It’s somewhat similar to Drupal, in the sense of being a unified data model. In Elgg, the data model is built on atomic data units called entities. Entities are basically everything from the site of the user, to blog posts, photos, videos, pages, comments, etc. As such, you don’t have to create new tables and fields for your database to create plug-ins with customizations. This helps developers make plug-ins quicker so that they are comprehensively integrated with the Elgg framework.Why Clean Your Elgg DatabaseWell, most of the websites based on Elgg face issues in their database at one point or another. So cleaning up the database is more of a routine job to resolve such issues. It not only helps you improve the website speed, but also prevents page crashes and optimizes your database. The main issues in Elgg database overtime are:1. Missing entries in entity type tables 2. Users without email or username 3. Group entity without the owner guide 4. Entities associated with deleted owner(s) 5. Obsolete meta data, meta strings, and annotationsObsolete meta data, meta strings, and annotationsElgg already offers a Garbage Collector plug-in that helps in cleaning up the database tables. The following steps will help you set up the Garbage Collector:1. Sign in to the Elgg site as Administrator 2. Go to the Plugins page and find the Garbage Collector 3. Activate the plugin and you can now see the link appearing on the Settings page 4. Choose the number of times you want Garbage Collector to clean database based on once a week, once a month, or once a year. Once a month is generally recommended.The Garbage Collector plugin is quite effective in deleting data from the database. That being said; there is not much functionality available in the type of data you want to keep or delete. For that, there is a DB Freshener that provides an intuitive UI to manage all your corrupted and incomplete data. It helps the admin to view and delete the data they want and displays corrupted and incomplete data as well. It can mainly help you to manage users with email or username, incomplete entities, and orphaned entities, Meta data, annotations, and Meta strings.As most Elgg sites face issues in their database, the DB Freshener helps them clean these issues using the ‘Check Database’ button. You can optimize the database tables at any giving time by clicking the ‘Optimize Tables’ button.The DB Freshener allows you to optimize the website speed, prevent pages from crashing, and keeps your database free from unnecessary clusters of data, all of which the Garbage Collector should do. There is an Enterprise version of the DB Freshener currently in development and will be launched by Cubet soon to manage Elgg databases more effectively. If you have the Garbage Collector enabled, disable it from the Settings page and download the DB Freshener plugin to wave your database dilemmas goodbye.Happy coding; y’all!