Support

Account

Home Forums General Issues Suggestions for scaling ACF Reply To: Suggestions for scaling ACF

  • I have been wanting, for a long time, to find the time to see if I can bypass then entire WP functionality for update_post_meta() and the other functions in WP that deal with one data item at a time. In my opinion, the entire operations surrounding getting, setting and updating meta values and options is done poorly, one…. at…. a…. time…. That’s the way that WP is build because they never expected that anyone would want to store that much extra data. I don’t think this is going to change any time soon. I’ve seen several discussion about in on trac and nothing ever comes of them.

    It is possible in MySQL to insert multiple rows all with a single query. Even $wpdb has this ability. If you could bypass ACF’s saving of fields you’d simple need to use 2 queries. 1) Deleted everything in the DB related to a post_id and meta_key and 2) Insert all the updated values. Yes, this is a lot of deletes and inserts, but it is done in only 2 queries. The time it takes MySQL to perform all of these deletes and inserts in minimal. The reason it takes WP so long is that each query request takes longer that MySQL would take to do 1000 deletes and 1000 inserts. But first you need to bypass ACF, then you need to assemble the queries, and then somehow stop ACF form doing them anyway. It the 1st and 3rd parts that I’m not sure about and have not had the time to investigate.