{"id":14979,"date":"2025-01-24T13:36:27","date_gmt":"2025-01-24T13:36:27","guid":{"rendered":"https:\/\/www.20i.com\/blog\/?p=14979"},"modified":"2026-01-16T14:54:02","modified_gmt":"2026-01-16T14:54:02","slug":"optimise-wordpress-database-no-plug-ins","status":"publish","type":"post","link":"https:\/\/www.20i.com\/blog\/optimise-wordpress-database-no-plug-ins\/","title":{"rendered":"How to optimise your WordPress database without any plug-ins"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">WordPress, as a database-driven CMS, relies heavily on its database to store essential data like posts, comments, settings, customer orders, and user information. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Over time, this database can become cluttered with unnecessary data, which not only increases its size but can also slow down your website.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Regularly optimising your database offers several benefits:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reduced database size, saving server resources.&nbsp;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Faster query execution, improving performance.&nbsp;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enhanced website speed, resulting in a better user experience.&nbsp;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Simplified database management.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we\u2019ll explore common types of unnecessary data in WordPress databases and how to clean them up, without relying on plugins.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Familiarise Yourself with WordPress Databases<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before diving in, take time to <a href=\"https:\/\/codex.wordpress.org\/Database_Description\" target=\"_blank\" rel=\"noreferrer noopener\">understand the structure of WordPress database tables<\/a>. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1088\" height=\"880\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2024\/12\/wordpress-database-description.png\" alt=\"\" class=\"wp-image-14980\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2024\/12\/wordpress-database-description.png 1088w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/wordpress-database-description-300x243.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/wordpress-database-description-768x621.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/wordpress-database-description-400x324.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/wordpress-database-description-800x647.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/wordpress-database-description-832x673.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/wordpress-database-description-150x121.png.webp 150w\" sizes=\"auto, (max-width: 1088px) 100vw, 1088px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Familiarity with tables like wp_posts, wp_options, and others will help you confidently identify and remove unwanted data.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using phpMyAdmin for Database Management<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can manage your WordPress database via phpMyAdmin. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Access it in <a href=\"https:\/\/my.20i.com\/\">My20i <\/a>&gt; Manage &gt; Web Tools &gt; phpMyAdmin. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1097\" height=\"321\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2024\/12\/my20i-web-tools.png\" alt=\"\" class=\"wp-image-14981\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2024\/12\/my20i-web-tools.png 1097w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/my20i-web-tools-300x88.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/my20i-web-tools-768x225.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/my20i-web-tools-400x117.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/my20i-web-tools-800x234.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/my20i-web-tools-832x243.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2024\/12\/my20i-web-tools-150x44.png.webp 150w\" sizes=\"auto, (max-width: 1097px) 100vw, 1097px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once there, sorting tables by size can help identify the largest ones for optimisation.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Backup First!<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Always back up your database before making any changes. You can:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Export it directly using phpMyAdmin&#8217;s <strong>Export<\/strong> tool.&nbsp;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the <strong>Backup Restore<\/strong> tool in My20i for a complete backup.&nbsp;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Cleaning Up Your WordPress Database<\/strong>&nbsp;<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Remove Post Revisions<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress creates a new revision every time you update a post. These revisions can accumulate over time. To clean them up:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use phpMyAdmin to filter rows in the wp_posts table with the keyword revision, then delete them.&nbsp;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Alternatively, execute this SQL query:&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>DELETE FROM wp_posts WHERE post_type = 'revision';&nbsp;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To prevent excess revisions in the future, add this to your wp-config.php file:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('WP_POST_REVISIONS', 5);&nbsp;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Delete Auto-Drafts<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Auto-drafts are temporary saves of posts or pages. Once published, they remain in the database unnecessarily. Use phpMyAdmin to search for auto-draft and delete the rows, or run:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DELETE FROM wp_posts WHERE post_status = 'auto-draft';&nbsp;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Clear Trash Data<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress sends deleted items to the trash instead of permanently deleting them. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can speed up trash clearance by adding this to wp-config.php:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('EMPTY_TRASH_DAYS', 7);&nbsp;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Replace 7 with your preferred number of days.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Remove Spam Comments<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Spam and unapproved comments are stored in the wp_comments table. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Delete them manually via phpMyAdmin or write a query to bulk-remove spam.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Clean Up Old Plugin and Theme Data<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Unused plugins and themes can leave behind orphaned data. Search tables like wp_options, wp_postmeta, and wp_commentmeta for prefixes associated with the plugin or theme, e.g., WooCommerce uses wp_wc_.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Check for Plugin Cron Jobs<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Some plugins leave behind cron jobs after deactivation. Use phpMyAdmin to review the wp_options table and delete outdated cron jobs.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Optimise Database Tables<\/strong>&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Optimize Table command in phpMyAdmin can be useful when reducing table sizes.&nbsp; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The command essentially defragments data, rebuilds indexes and reclaims unused space.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s recommended to use the tool as part of routine database optimisation, after deleting large amount data and if your website experiences slow queries.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Boost Performance with Redis Caching<\/strong>&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Employing <a href=\"https:\/\/www.20i.com\/blog\/redis-object-caching-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">Redis<\/a> a caching layer will benefit your wordpress website. Redis stores results of MySQL queries in memory and Redis will serve the results instantly. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the queries are already cached, this will free MySQL\/MariaDB to handle other tasks more effectively. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.20i.com\/blog\/redis-object-caching-wordpress\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1080\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2023\/06\/Redis-object-caching-and-WordPress.jpg\" alt=\"Redis object caching and WordPress\" class=\"wp-image-11087\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2023\/06\/Redis-object-caching-and-WordPress.jpg 1920w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-300x169.jpg.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-768x432.jpg.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-1536x864.jpg.webp 1536w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-370x208.jpg.webp 370w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-270x152.jpg.webp 270w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-570x321.jpg.webp 570w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-740x416.jpg.webp 740w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2023\/06\/Redis-object-caching-and-WordPress-150x84.jpg.webp 150w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Our <a href=\"https:\/\/www.20i.com\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress optimised Managed Cloud hosting<\/a> comes with Redis pre-installed.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Final thoughts<\/strong>&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress is a robust platform, but as a database-driven CMS, it requires regular maintenance. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By removing clutter like spam comments, post revisions, and leftover plugin data, you\u2019ll keep your database lean and efficient. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This proactive approach ensures faster database queries, better server resource utilisation, and an overall improvement in website performance. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Take advantage of tools like phpMyAdmin, Redis caching, and 20i\u2019s optimised hosting to maintain a healthy, high-performing WordPress site.<\/p>\n\n\n<div class='code-block code-block-4' style='margin: 8px 0; clear: both;'>\n<hr>\n<br \/><a href=\"https:\/\/www.20i.com\/wordpress-hosting\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2026\/03\/Blog-Ad-WordPress-1200x625-1.png\" loading=\"lazy\" alt=\"Managed WordPress Hosting\"><\/a><\/div>\n\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"WordPress, as a database-driven CMS, relies heavily on its database to store essential data like posts, comments, settings,&hellip;","protected":false},"author":25,"featured_media":17232,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"ub_ctt_via":"","_monsterinsights_skip_tracking":false,"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[60],"tags":[79,76],"class_list":["post-14979","post","type-post","status-publish","format-standard","has-post-thumbnail","category-web-design-dev","tag-web-development","tag-wordpress","cs-entry"],"featured_image_src":"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-optimise-your-WordPress-database-scaled.png","author_info":{"display_name":"Ben Perry","author_link":"https:\/\/www.20i.com\/blog\/author\/benperry92\/"},"_links":{"self":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/14979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/comments?post=14979"}],"version-history":[{"count":7,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/14979\/revisions"}],"predecessor-version":[{"id":15140,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/14979\/revisions\/15140"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/media\/17232"}],"wp:attachment":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/media?parent=14979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/categories?post=14979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/tags?post=14979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}