Preskoči na sadržaj
BeoHosting
BeoHosting

9 min

How to Optimize WordPress Database

Clean revisions, transients, spam and OPTIMIZE TABLE.

BeoHosting Tim

10+ godina iskustva — Stručnjaci za web hosting i infrastrukturu

Poslednje ažurirano:

A bloated WordPress database makes your site slow, makes backups huge, and stresses the MySQL server. Over time, post revisions, expired transients, spam comments and orphaned metadata accumulate — sometimes doubling database size for no good reason. This guide shows how to clean up safely, optimize tables and keep the database lean long term.

How to Optimize WordPress Database

1

Back up first — always

Before touching the database, take a full backup via UpdraftPlus, JetBackup or cPanel Backups. If something goes wrong, restore in 5 minutes.

2

Delete post revisions

Every edit saves a revision. After 50 edits, a post has 50 copies. Limit in wp-config.php: define('WP_POST_REVISIONS', 5). Delete existing with WP-Optimize → "Clean post revisions".

3

Clear expired transients

Transients are temporary cache entries. Many plugins create them but never clean up expired ones. WP-Optimize → "Clean expired transients" removes orphans safely.

4

Remove spam and trashed comments

WP-Optimize → "Clean spam and trashed comments". If you use Akismet, set it to auto-delete spam older than 30 days.

5

Clean orphaned post meta and term relationships

When you delete plugins or themes, they leave metadata in wp_postmeta and wp_options. WP-Optimize → "Clean orphaned data" finds and removes these safely.

6

OPTIMIZE TABLE — reclaim physical space

After deletions, MySQL still holds the space until you OPTIMIZE. WP-Optimize → "Optimize database tables" runs OPTIMIZE TABLE on every table.

7

Schedule automatic cleanup

WP-Optimize Free and Premium both let you schedule weekly cleanup. Set it once and forget — database stays lean automatically.

Spremni da pokrenete svoj sajt?

SSL zaštita
Brzina
24/7 podrška

Pridružite se 4.000+ zadovoljnih korisnika. Besplatna migracija i 15 dana garancije povrata novca.

15 dana garancija povrata novca
Besplatna migracija15 dana garancija24/7 podrška

FAQ

Odgovori na najčešća pitanja o našim uslugama.

WP-Optimize is safe — it only removes data WordPress no longer needs. Manual MySQL DELETE can be dangerous without schema knowledge. Always backup first.

Monthly for small blogs, weekly for active e-commerce sites. WP-Optimize Premium scheduling automates this. After major plugin uninstalls, run once.

On a heavily bloated database (1 GB+), cleanup can cut query time 30-50%. On a typical small site, the difference is modest but still worth doing.

Both clean safely. WP-Optimize has more features (caching, image optimization). WP-Sweep is simpler and lighter. For most users, WP-Optimize is the better all-in-one.

No, WP-Optimize itself does not slow the site down. The plugin is lightweight and only active during optimization. Scheduled optimizations run in the background and do not affect visitors. The premium version even adds page caching and image lazy loading, which speeds the site up further. The only moment a brief slowdown can occur is while optimizing a very large database (500 MB+) — so we recommend scheduling optimization during your lowest-traffic period (e.g. 3-4 a.m.).

Naše garancije za vaš mir

Zaštićeni ste sa svake strane

15 dana garancije

Vraćamo novac bez pitanja u prvih 15 dana.

Besplatna migracija

Mi prebacimo vaš sajt bez prekida — vi ništa ne radite.

24/7 podrška

Naši stručnjaci su tu 24/7 kroz tikete i live chat.