WPSOLR slow with ACF plugin option "Replace custom field abel on facets" enabled

  • webmasterbslnl
    Participant
    # 1 year, 9 months ago

    Hi, I identified a slow query on two sites using WPSOLR. Both sites have rather large postmeta tables that normally do not have an bad influence on the site performance. This is the query:

    SELECT distinct meta_key, meta_value FROM wp_postmeta WHERE meta_key LIKE '_%' AND meta_value like 'field_%'

    On site 1 this query ran 6 times per pageview (when performing a search/filtering) which took 0,5 sec each. So 3,5 sec in total! The postmeta table holds about 700k records.
    On site 2 this query ran just once per pageview (when performing a search) and that took 0,1 sec which is still relatively slow. The postmeta table holds about 90k records.

    I ran the query manually and on both sites and it returned empty record sets. Seems I did not need it anyway. I found that after I disabled the option “Replace custom field name by ACF custom field label on facets” the search and filter performance went from quite slow/sluggish to pretty good/very fast.

    I do not really understand what the query is trying to do. Nor what the ACF extension does. I disabled it and reindexed and still my acf fields are in the index. So question 1: What is it for exactly? Repeater field names?

    And question 2: Why not store the result in a transient or find a faster way to get the ACF related required data? It should improve performance immediately.

    Kind regards,
    Harmen

    wpsolr
    Keymaster
    # 1 year, 9 months ago

    This query is retrieving ACF repeated fields, only in the admin. You can deactivate it if you’re not accessing tab 2.2.

    webmasterbslnl
    Participant
    # 1 year, 9 months ago

    I’m not sure what you mean by ‘only in the admin’. The query I mentioned affects the search performance not only when logged in as admin or when accessing tab 2.2 but also for anonymous front end users on every search performed.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.