Skip to content

Large number of queries while using Member field inside Grid field #4918

@itelligence

Description

@itelligence

Description of the problem
Member field within grid field cause excessive number of MySQL queries.

How To Reproduce
Steps to reproduce the behaviour:

  1. Create a fluid field called Page Sections
  2. Add some basic fields for content creation.
  3. Add a grid field and call it Team
  4. Add Member field inside the grid field for relationship
  5. Create a new entry but for the first test don't use the Team field
  6. View the number of queries, on my test I had approx. 114
Image

queries
7. Go back and edit the page you just created and add Team field from within your fluid field "Page Sections"
8. Save and preview. Number of queries increased from 117 to 914

Image
  1. Repeat the process by adding more members and previewing the page, each time the number of queries more than doubles. With 2 members queries increased to 1714, with 3 it increased to 2514.
Image Image

pages/index snippet of the templates

  • layouts/_html-wrapper
  • pages/index (calls layouts/_html-wrapper), code provided below

`{exp:channel:entries channel='{ch}' disable='{ch_disable}' limit='1' require_entry='yes' status='open'}
{page_sections}
...
{page_sections:team}
{content}
{if content:field_row_count == 1}



{/if}
{content:associated_account}



{if '{content:associated_account:linkedin}' != ''}

{/if}
{if '{content:associated_account:email}' != ''}

{/if}

{if "{content:name_title}"}{content:name_title}{if:else}{content:associated_account:screen_name}{/if}


{content:associated_account:position}


{content:bio}

{/content:associated_account}
{if content:field_row_count == content:field_total_rows}


{/if}
{/content}
{/page_sections:team}
{/page_sections}

{!-- no results --}
{if no_results}

No content published


{/if}
{/exp:channel:entries}`

Screenshots / Videos / Template Code

Environment Details:

  • EE 7.5.13
  • Nginx 1.26.2
  • PHP 8.2.26
  • MySQL 10.11.13-MariaDB-0ubuntu0.24.04.1
  • Ubuntu 24.04.2 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: AcceptedBug has been confirmed, is reproducible, and ready to work on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions