Category query very slow on multilingual site I have a directory of sea ports with a google map that loads about 450 records. The map and listings and pagination work fine. On their own, I get a 2.5 sec page load average.

However as soon as I add a search form that populates a chained select for countries and ports the load time goes up to 8 secs.

The search form code looks like this 

{% set categories = craft.categories.group('locations').limit(null) %}

&lt;label&gt;Country&lt;/label&gt;
&lt;select id="countries" class="countries" name="country"&gt;
    &lt;option value=""&gt;Select...&lt;/option&gt;

    {% cache %}
        {% for country in categories %}
            {% if country.level == 1 %}
                &lt;option value="{{ country.slug }}"&gt;{{ country.title }}&lt;/option&gt;
            {% endif %}
        {% endfor %}
    {% endcache %}
&lt;/select&gt;

&lt;label&gt;Ports&lt;/label&gt;
&lt;select id="ports" name="port" class="ports" disabled="disabled"&gt;
    &lt;option value=""&gt;Select a country first&lt;/option&gt;

    {% cache %}
        {% for port in categories %}
            &lt;option value="{{ port.slug }}" class="{{ port.parent | lower }}"&gt;{{ port.title }}&lt;/option&gt;
       {% endfor %}
    {% endcache %}

&lt;/select&gt;


It seems that this code cost about 5 seconds of load time.

I have checked the profile output and seen the query for the categories. It's huge.  I can't see how to get the page to load faster as I can't see eager loading applying to a category group, and caching doesn't really help here.

Any ideas on how to optimise this portion?
It's hard to know for sure without seeing your query profile output, but try eager loading your ports field like so:

{% set categories = craft.categories({
    group: 'locations',
    limit: null,
    with: ['ports']
}) %}