Degraded query performance after "Is Micro-content" filter change

Created on 12 September 2024, 3 months ago
Updated 13 September 2024, 3 months ago

Problem/Motivation

Changes in πŸ› "Is Micro-content" filter has surprising behavior with non-micronode types Fixed resulted in degraded view rendering on a site with a relatively large number of content items (14K+) when using the "Is Micro-content" filter.

Proposed resolution

Remove the use of 'LIKE / NOT LIKE' in the query. All credit goes to @danflanagan8 for the fix.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @justcaldwell
  • Merge request !13Improve query performance β†’ (Merged) created by justcaldwell
  • Status changed to Needs review 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    > All credit goes to @danflanagan8 for the fix.

    Don't forget that I should also get all the credit for the regression!!!

  • Pipeline finished with Success
    3 months ago
    Total: 189s
    #281400
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

    LOL! All's well that ends well.

  • Status changed to RTBC 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    That MR looks correct to me, @justcaldwell.

    I don't know if it's really legal for me to RTBC this. I guess I'm asserting that the MR contains the code I posted on the other issue and that you tested on the other issue.

  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

    Confirming that I tested in our environment and the fix restored previous performance. +1 RTBC.

  • Status changed to Needs work 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

    I'll have to defer to stronger minds on that one. The API docs for getCacheTags() read:

    The cache tags associated with this object.

    When this object is modified, these cache tags will be invalidated [emphasis mine].

    I guess it's not clear to me what role a filter should have in invaliding cache tags. In this case, the list of node types.

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    That doc doesn't really describe this use of getCacheTags unfortunately. This is the usage where we're saying, "Cache the result of this until these tags are invalidated." If any node type has its configuration updated, it's possible that the list of micronode types has changed and so we can no longer trust the cached results of the filter.

  • Pipeline finished with Success
    3 months ago
    Total: 149s
    #281535
  • Status changed to Needs review 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

    Well, when you put it that way, it absolutely makes sense!

    I updated the MR and did a bit of testing on my end. Definitely no detrimental effects, but the view returned appropriate results with or without getCacheTags. (I toggled the "Is microcontent" setting of an entity to test.)

    Could be our view isn't getting cached in any case for some other reason.

  • Status changed to RTBC 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    > Could be our view isn't getting cached in any case for some other reason.

    Yeah, I was wondering myself why the tests didn't fail without this. The views in the test module all have caching configured correctly, from what I can tell. There's at least some chance that the presence of the "content type" filter on the View would result in the config:node_type_list cache tag getting added to the page. That's my best guess, but just a guess.

    Thanks for making the change!

  • Pipeline finished with Skipped
    3 months ago
    #281945
  • First commit to issue fork.
  • Status changed to Fixed 3 months ago
  • πŸ‡ͺπŸ‡ΈSpain marcoscano Barcelona, Spain

    Looks good to me! Thanks for the quick fix!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024