Reduce database WP

Matta28

Jr Vip
Joined
Jun 6, 2018
Messages
3,383
Reaction score
1,454
Any good tricks to reduce database, Ive tried to delte old posts but host said that the database increased after that
 
Check Images
WP usually creates like sooo many versions of the same picture in so many different sizes.
Only use what you need, rest really don't matter.
 
Make sure all images are uploaded eleseware like Google drive and only use a link in the database to get them .

Don't store images locally at all, upload to another service .

Use the users database id to rewrite to the image name and added to database .
 
If your running MySQL it very light .

Might need a better server if it not images doing all the pain .
 
Check Images
WP usually creates like sooo many versions of the same picture in so many different sizes.
Only use what you need, rest really don't matter.
Make sure all images are uploaded eleseware like Google drive and only use a link in the database to get them .

Don't store images locally at all, upload to another service .

Use the users database id to rewrite to the image name and added to database .

Thanks for the answers guys, gonna check this out when Im back from the gym
 
Thanks for the answers guys, gonna check this out when Im back from the gym
just be careful
Google has like an request limit of 10,000 or something anymore is paid
and having constant google requests may slow down your website if you have lots of pictures on that article/page/homepage etc.
You could do something like have a CDN host it for you completely. Bunny does thta if i remember correctly,
 
just be careful
Google has like an request limit of 10,000 or something anymore is paid
and having constant google requests may slow down your website if you have lots of pictures on that article/page/homepage etc.
You could do something like have a CDN host it for you completely. Bunny does thta if i remember correctly,
What does/is CDN host?
 
You should change your hosting for sure,
At most spammy websites with 100k+, you shouldn't be getting anymore than 2-5 GB database storage taken,
Therefore, your hosting is basically limited if you struggle at such point,

Move to a VPS, you'll get 50 GB with most of the small packages and it won't cost you anything more than $10 and 15-30 mins to set things up,
Using some free panels like aaPanel would make it a piece of cake as well
 
You should change your hosting for sure,
At most spammy websites with 100k+, you shouldn't be getting anymore than 2-5 GB database storage taken,
Therefore, your hosting is basically limited if you struggle at such point,

Move to a VPS, you'll get 50 GB with most of the small packages and it won't cost you anything more than $10 and 15-30 mins to set things up,
Using some free panels like aaPanel would make it a piece of cake as well

They tried upselling me to a VPS plan, but I figured out my problem, wp automatic. I've freaking run and forgot about it on that site and had XX thousands posts when I checked now. In the process of removing posts and media and gonna see how it's going. I've been pretty happy with this host, my previous host was worse, hostgator.
 
What do you mean by that? Do we have to pay to Google? Thanks for time answering :)
Google Cloud bucketnaming Storage thingo or https://console.cloud.google.com/home/dashboard
is pretty much free to some extent, similar to AWS
Depends on what you use and how much you are using it.
https://blog.moove-it.com/how-to-set-up-a-google-cloud-cdn-for-serving-images/
Would still recommend going with a CDN service who is tailored to these needs, you can get away with somethng as cheap as $1-2 a month with them.
 
Removing the posts and media helped, thank god for plugins since I started manually for 30min before f this, gonna look for plugins
 
Any good tricks to reduce database, Ive tried to delte old posts but host said that the database increased after that
Move your setup to something like vitess if it ever gets that serious. Or use something managed, like planet scale, which uses vitess internally.
 
Warning: Before doing any steps below, please do backup is important.

How to optimize your databases of WP:

1. Login to your myPhpAdmin
2. Select your database
3. Select your tables that you wish to optimize

Then select this option
1672437841277.png


Other way to do it is by compressing images and using this plugin
https://wordpress.org/plugins/wp-optimize/ (this will optimize your database, but won't do miracles)

Consider MySQL Tuning or hire a freelancer to do it.

Cheers.
 
i will share the MYSQL query that will solve your issue
DELETE FROM `d2_posts` WHERE `post_date` BETWEEN '2020-09-01 19:10:40.000000' AND '2021-12-31 19:10:40.000000' ORDER BY `post_date` ASC

just adjust the table and date range, once you finish with until next day to see the new size
 
How to optimize your databases of WP:

1. Login to your myPhpAdmin
2. Select your database
3. Select your tables that you wish to optimize
I did this actually, did not help.

But in my case everything is fixed and work as normal
 
There are several things you can try to reduce the size of your database:

  1. Delete unnecessary data: One way to reduce the size of your database is to delete any unnecessary data, such as old posts, comments, and media files that are no longer needed.
  2. Optimize your database tables: You can use a tool such as phpMyAdmin to optimize your database tables, which can help to reduce their size and improve their performance.
  3. Use a plugin to compress your database: There are plugins available for WordPress, such as WP-Optimize, that can help to compress your database and reduce its size.
  4. Enable database caching: Enabling database caching can help to reduce the number of database queries that are needed to load your website, which can help to reduce the load on your database.
  5. Use a database management tool: There are tools available, such as MySQL Workbench, that can help you to manage your database and identify any areas where you can optimize or reduce its size.
It is also a good idea to regularly back up your database, so that you can restore it if any issues arise.
 
Back
Top