Wordpress LScache Plugin: Dont save litespeed-optimize-size in wp_postmeta
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi, For every optimized image, there is a litespeed-optimize-size line saved in the wp_postmeta table. I can see that this is used solely for showing the total savings in Media panel. However, can you please make changes and stop saving these in wp_postmeta table? Perhaps you could create a different database table for this purpose. The problem: for instance, we run a marketplace, which means that new products are being added every day, together with lots of pictures and thus were bloating our postmeta table with the litespeed-optimize-size lines. Hi @mikeyhash, do you still wish to check the optimization information on media page? Or just want to reduce the post_meta size? @stanleylitespeed, both Sure, I could remove the add/update_post_meta in the plugins file and get rid of the unpleasant post_meta on my own, but I am hoping for a different approach from you guys in order to better optimize this (creating a new table or something). Hi, This is a good question. Usually its a normal behavior to save meta data in wp_postmeta table. We will note this and try to improve it after v3.3. @hailite, well, yes, everybody saves almost everything in wp_postmeta, because its the easiest way to go. But from a true, better, on-going performance perspective, I think a custom table should be used in this case. Thanks for noting that. Cant agree more. To achieve that along with some other improvements for image optimization, we will do in a special version. Will update here once its done. Hi again, We are currently working on the scheduled image optimization coding. Regarding this concern, we found it will cause an additional new table and extra hooks when operating WP attachments (e.g. delete/update attachment). Also we will add another key-value to that record litespeed-optimize-size, which will mark if that image group is optimized or not. For now we will attach to that postmeta record. But will keep an eye on it to figure out potential improvement. @hailite, thanks for the update. Let me know if I understand correctly: 1) you are going to add a new table in db (for the scheduled image optimization). 2) you are making litespeed-optimize-size postmeta a little bigger by adding one more element in the array. So, whats wrong with adding 2 new tables? 1) Not exactly. We wont add new tables for now. Will still keep using the one wp_litespeed_img_optm even after we added the extra folder (outside of /upload) optimization feature. 2) Correct. That is for faster scan feature to re-run the optimization for finished image groups which generated new size thumbnails (this could happen when using couple 3rd party plugins). Not finally decided to add the new key yet. For more tables, if you delete an image from WP library, we had to manually hook the deletion of related records in additional tables. But if use original postmeta table, we dont need to do anything. This can reduce the additional hooks to WP. Hope I clarified @hailite, yes, more clear now. Well, yes, as I said, saving stuff in postmeta is the easiest way to go But I would say that the delete_post hook can be used very easy, together with the simple function for the sql deletion from the new custom table. Perhaps youd reconsider this. In the meantime, I will probably change the code on my website so that it doesnt save the litespeed-optimize-size postmeta anymore. Sure you can always do that way. In future if we have any code changes to image optm class, the change log will tell. Just keep an eye on it
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference