How to clean wp_posts and wp_postmeta tables from Elementor data?
-
Hi,
I couldn’t find a good solution for my problem, so I decided to make a topic.
My DB is enormous (783MB!) and the bigest tables are wp_postmeta (637MB) and wp_post (123MB). I have tried to clean it up by various plugins but there is no effect.
I found queries to check what I could delete:
- Select from wp_postmeta by meta_key with counting
SELECT meta_key, COUNT( meta_key ) FROM wp_postmeta GROUP BY meta_key
Result:
meta_key
_additional_settings 4
_auxin_meta_client 8
_auxin_meta_release_date 8
_display_related 8
_dp_original 27
_edit_last 52
_edit_lock 193
_elementor_controls_usage 387
_elementor_css 25
_elementor_data 1767
_elementor_edit_mode 1788
_elementor_page_assets 715
_elementor_page_settings 1656
_elementor_source_image_hash 16
_elementor_template_type 1804
_elementor_version 1791
_form 4
_format_audio_embed 35
_format_audio_player_skin 35
_format_quote_source_name 35
_format_quote_source_url 35
_format_video_embed 35
_format_video_player_skin 35
_hash 4
_locale 42. Order meta_key by size:
SELECT meta_key, (SUM(LENGTH(meta_id)+LENGTH(post_id)+LENGTH(meta_key)+LENGTH(meta_value)))/1048576 AS
Size
, COUNT(*) ASCount
FROM wp_postmeta GROUP BYmeta_key
ORDER BYSize
DESC;Result:
meta_key size count _elementor_data 568.7895 1767 _elementor_controls_usage 3.3453 387 _wp_attachment_metadata 0.5746 660 _elementor_page_settings 0.1319 1656 _elementor_page_assets 0.0943 715 _wp_page_template 0.0840 1786 _elementor_template_type 0.0701 1804 _elementor_edit_mode 0.0628 1788 _elementor_version 0.0566 1791 _wp_attached_file 0.0455 830
3. Select entries without ID from wp_posts and wp_postmeta:
SELECT * FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL
And here the result is just few rows of meta key called “auxin-autop” and deleting them obviously doesn’t solve the problem. Probably this query is not valid for this problem?
To sum up.
I understand that I should delete Elementor data but how would I know which I can remove without breaking my site?
Thank you in advance for helping me with my issue!
- You must be logged in to reply to this topic.