Home › Forums › General Issues › Removing Old Entries From Database If You Have List of Field ID's › Reply To: Removing Old Entries From Database If You Have List of Field ID's
The main issue with wholesale deleting of data is that even if you are very careful and you’re pretty sure the field names are not used anywhere else, there can almost never be 100% certainty that they are not.
There can also be an issue with sub fields because the only way to deleted these would be using a “LIKE” query. For example, you have a repeater (this includes flex fields and group fields) named “REPEATER_FIELD” you would need to delete everything that was “LIKE” “REPEATER_FILED_%”. This is where the certainty of field names not being reused can drop further.
In addition to the above, for every ACF field name there is also the field key reference that also needs to be dealt with. For every field there is another field that starts with an underscore. “FIELD_NAME” has a corresponding “_FIELD_NAME”.
That being said, you can use phpMyAdmin and do delete queries on the tables deleting anything where the meta_key matches or is like the field you want to delete.
With that said, the size of a database will only severely effect performance of a site when doing “LIKE” queries on non-indexed columns. There can also be a small performance hit when doing other queries on non-indexed columns, but if you are never doing a query based on these old meta_keys (field names), the extra data in the DB should not effect performance. For example:
'SELECT *
FROM wp_postmeta
WHERE meta_key = "field_name"
AND meta_value' = "some value"'
Will not effect performance because “meta_key” is indexed and “meta_value” will never be looked at in rows where the meta_key does not match.
It may bother some people that all this unused data is in the database, but any idea that the size of a DB alone will affect the performance of a site, as far as I’m aware, is incorrect. Issues arise because the queries on the data and how they are constructed and not due to the data that is being queried.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.