Eager loading on entry not reducing queries Using this snippet returns me 38 queries on my homepage without the Eager Beaver plugin.

{% do craft.app.elements.eagerLoadElements(
    className(entry),
    [entry],
    ['headerImage', 'image1', 'image2']
) %}


Without the above loading all three images with .one() gives me 33 queries.

Is this expected behavior or am I doing something wrong?
I don't think eager loading will help in this case because you're trying to eager load fields with only a single relationship (asset). It's not the n+1 query problem eager loading is meant to solve.

If you had an asset field with multiple assets selected, you would see some benefit. But even then, if there are only a few assets, the small penalty of eager loading might not outweigh the small cost of queries for a few assets.

Bigger gains would come from nested relationships. For example, a set of related entries each with an asset for a thumbnail image.

{% do craft.app.elements.eagerLoadElements(
    className(entry),
    [entry],
    ['entriesField.image1']
) %}

{% for item in entry.entriesField %}
    {% set image = item.image1[0] ?? null %}
    {% if image %}
        {{ image.url }}
    {% endif %}
{% endfor %}


Also, it might be worth noting that in your testing, it matters what data you actually use.

In my test, this produced 19 queries:

{% set asset = entry.headerImage.one() %}
{{ asset.title }}


But this produced 23 queries:

{% set asset = entry.headerImage.one() %}
{{ asset.url }}