Skip to content

[4.x]: GraphQL schema is no longer lazy loaded #15429

@markhuot

Description

@markhuot

What happened?

Description

The entire GraphQL schema is read in on every request, regardless of the query complexity or query needs. Because of this our web requests are rather slow (1.5s instead of 500ms). This adds up when you have a headless front-end making 3-4 requests per page.

I believe I've identified the reason for this, here: b9d8ec5

Steps to reproduce

  1. Submit a GraphQL query for {ping}.
  2. Notice that every matrix block is queried, every entry type is queried, etc… via the DB query log

Expected behavior

The schema should be lazy loaded, where possible.

Actual behavior

The entire schema is read every time.

Notes

I'm not sure how realistic is to reverse this decision or if there could be a config for it? Basically wondering what sort of issues I'd run in to if I tried to force a lazy schema.

Craft CMS version

4.9.5

PHP version

8.3.4

Operating system and version

Ubuntu

Database type and version

MySQL 8

Image driver and version

n/a

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions