IRIsuru Ratnayake

How I Fixed WordPress Inode & Database Limits on SiteGround

Case study: a custom read-only plugin found 1.25 GB of logs and cache in a 1.4 GB WordPress database, plus 45,592 wasted inodes on SiteGround.

Isuru Ratnayake

Isuru Ratnayake

· 8 min read

A client's WordPress site on SiteGround shared hosting was heading for its inode and database size limits. The database had grown to 1.4 GB, and nobody knew why. I built a small read-only WordPress plugin, Storage & Inode Analyzer, to find out. It showed that about 1.25 GB of the database was plugin logs and stale cache, not content. An unused staging site was also using 45,592 inodes.

After the cleanup, the database is 173 MB and the account uses 63,271 inodes, down from 108,863.

This post covers what inodes are and what was filling the account. It also explains how the plugin works and the exact steps I took to clean it up safely.

What is an inode in Hosting?

An inode is one file or one folder on your hosting account. Each image, thumbnail, cache file, log file, backup and plugin file counts as one inode. A single WordPress image upload can create five or more inodes, because WordPress saves several resized copies of it.

Shared hosts cap inodes to protect the server. When you reach the cap, new files can't be written. Uploads fail, caches stop working and backups can break.

SiteGround inode limits by plan

SiteGround plan Inode limit per account
StartUp 200,000
GrowBig 400,000
GoGeek 600,000

The database has its own limit too. A large database also makes backups slower and can slow down the admin area.

Case study: what was filling the hosting account

The site was on SiteGround shared hosting, most likely the GoGeek plan. Here is what the scan found.

Inode usage: 108,863 in use

  • Main website: 56,732 inodes. The Uploads folder held 25,824 of them.
  • Old staging site: 45,592 inodes. No one was using it, so it was safe to delete.

The staging copy alone was 42% of the account's inodes.

Database size: 1.4 GB

Three tables used about 1.25 GB of the 1.4 GB, almost 90%:

Table Created by Size What it held
wp_sgs_log_events SiteGround Security Optimizer 570.0 MB Security event logs, safe to clear
wp_options WordPress core 390.6 MB Mostly Speed Optimizer cache, safe to clear
wp_wsal_metadata WP Activity Log 287.3 MB Activity log details, safe to clear

Why was wp_options 390 MB?

WordPress keeps site settings in wp_options. On a healthy site this table is usually only a few megabytes, so 390.6 MB was a red flag.

  • The plugin's autoload check listed the largest rows. Most of the space was cache entries written by SiteGround's Speed Optimizer plugin.
  • Almost all of those entries were stale or no longer relevant to any page. Speed Optimizer rebuilds what it needs, so deleting them was safe.
  • Many rows in wp_options are autoloaded, which means WordPress loads them into memory on every page request. Bloat here makes the database bigger and can slow down the whole site.

Why existing WordPress cleanup plugins didn't fit

There are plenty of database cleanup plugins and a few disk-usage tools. None of them suited this job:

  • Most only cover one limit. Database cleaners don't count files, and file browsers don't look at tables. I needed both in one report.
  • They clean before you can see anything. On a live client site I want to see what's there first and decide for myself. I didn't want a one-click "optimize" button.
  • They time out on shared hosting. Counting 100,000+ files in one PHP request hits the server's time limit, and the scan dies partway through.
  • They add to the problem. Some write their own logs and autoloaded options, so the database grows again.

Building the Storage & Inode Analyzer plugin

Storage & Inode Analyzer is a read-only WordPress plugin that shows where your hosting storage is going: database usage by table and inode usage by folder. It sits under Tools → Storage & Inodes. It never deletes anything, so every cleanup decision stays with a person.

Database size report

  • Data size, index size, overhead and row count for every table, sortable and filterable.
  • A guess at which plugin owns each table. For example, wp_sgs_log_events is labelled as SiteGround Security. It also flags tables with a different prefix, which are often left over from old installs.
  • Quick bloat checks: autoloaded options (with the 10 largest listed), expired transients, post revisions, auto-drafts, trash, spam, orphaned post meta and Action Scheduler logs.
  • Sizes come from information_schema. On hosts that restrict it, the plugin falls back to SHOW TABLE STATUS.

Inode scanner

  • Counts every file and folder under the folder you pick: the WordPress folder, wp-content, or the whole hosting account home.
  • Shows the results as an expandable folder tree, sorted by inode count, with percentage bars.
  • A Hotspots list shows the folders holding the most files directly. That is usually where cache, session, log or backup files pile up.

Built for shared hosting limits

Shared servers kill long-running PHP requests, so the scanner works in small steps:

  1. The scan runs in short batches of 3 to 20 seconds, always kept below the server's PHP time limit.
  2. Progress is saved to a database table after each batch. If a request gets killed, the next one picks up where it stopped, and you can pause and resume the scan.
  3. A lock stops two batches from running at the same time.
  4. For folders that contain only files, it uses directory link counts instead of checking each file. That makes huge cache folders cheap to count.

The plugin also stays out of the way. It loads nothing on the front end, adds no autoloaded options and caches the database report for 10 minutes. It never follows symlinks and never reads file contents.

On large accounts with SSH access, the same checks run through WP-CLI, which has no request time limit:

wp sia db --limit=20
wp sia scan --root=home --top=15

How I reduced the WordPress database size and inode count

With the report in hand, the cleanup took one session. If you follow the same steps, take a full backup first.

  1. Cleared the two log tables. Emptying wp_sgs_log_events and wp_wsal_metadata freed about 857 MB straight away.
  2. Removed the Speed Optimizer cache from wp_options. The autoload check showed most of the 390.6 MB was cache data from SiteGround's Speed Optimizer. Almost all of it was stale, so I cleared it.
  3. Deactivated Security Optimizer and Speed Optimizer. Both kept adding data to the database. Speed Optimizer would have filled wp_options with cache again, and the site didn't need either plugin.
  4. Deleted two unsafe files. The scan turned up newanalizator.php and a backup copy of it, newanalizator.php.back, in the site files. They weren't part of WordPress or any installed plugin, so I removed them. Unknown PHP files like these are always worth checking: malware such as Phantom Shell hides the same way.
  5. Deleted the old staging site. Removing its 45,592 inodes cut the account's inode use by about 42%.

Results: before and after

Measure Before After
Database size 1.4 GB 173 MB
wp_sgs_log_events 570.0 MB Cleared
wp_wsal_metadata 287.3 MB Cleared
wp_options 390.6 MB Cleared
Inodes in use 108,863 63,271

The database is now about 88% smaller. The client has room to grow, and the site no longer writes hundreds of megabytes of logs and cache it doesn't need.

How to stop your WordPress database and inodes growing back

  • Measure before you delete. Nearly 90% of this database was in three tables, and none of it was content. You only find that out by looking table by table.
  • Set log retention limits. Security and activity-log plugins can quietly grow to hundreds of megabytes. Keep 30 to 90 days of logs, or clear them on a schedule.
  • Watch what caching plugins write to wp_options. Check the largest autoloaded rows every few months, especially after installing a performance plugin.
  • Delete staging sites when the work is done. A full staging copy can double a site's inode count.
  • Check upload folders for leftovers. Old backups, export files and unused thumbnail sizes add up fast.

Frequently asked questions

How do I check inode usage in Hosting Server?

Most hosts show the total inode count in their control panel, but not where the files are. A plugin like Storage & Inode Analyzer, or the command find . | wc -l over SSH, shows which folders hold the most files.

Is it safe to empty the wp_sgs_log_events table?

Yes. The table only holds SiteGround Security Optimizer's event logs. Emptying it removes the log history, not any site content or settings.

Why is my wp_options table so large?

Usually because plugins store cache, logs or old settings there and never remove them. In this case most of the 390.6 MB was stale cache from SiteGround's Speed Optimizer.

Does deleting a staging site reduce inodes?

Yes. A staging site is a full copy of WordPress, so it uses almost as many inodes as the live site. Deleting this one freed 45,592 inodes.

Can I clear the WP Activity Log tables?

Yes, if you don't need the old activity history. The wp_wsal_metadata table holds extra detail for each logged event. Set a retention period in the plugin's settings so it doesn't grow back.

Need help with WordPress storage limits?

If your site is getting inode or database size warnings, or the database keeps growing and you don't know why, I can help. I build custom WordPress plugins and fix hosting and performance problems, and I'll find what's filling your account and clean it up safely, without breaking the live site.

Tell me what your host is warning you about and I'll reply within a few hours.

  • WordPress
  • Hosting
  • Database
  • Performance
  • Plugin Development
Isuru Ratnayake

Isuru Ratnayake

Senior WordPress & PHP Developer. Top Rated on Upwork with 250+ completed jobs and 15+ years of PHP & WordPress experience.