Answers.Body: <p>You could <a href="https://docs.craftcms.com/v3/dev/eager-loading-elements.html" rel="nofollow noreferrer">eager load</a> a little more to speed things up. Especially your <code>eventVenueName</code> and <code>eventCity</code></p>
  
  <p>For your query, try:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set entries = craft.entries ({
          section: 'events',
          limit: '30',
          order: 'postDate desc',
          with: [
              'eventMediaTile',
              'eventVenueName',
              'eventCity'
          ],
          relatedTo: category }) %}
  </code></pre>
  
  <p>Then in your <code>_card</code> do:</p>
  
  <pre class="lang-twig prettyprint-override"><code>&lt;a href="{{ entry.url }}" title="{{ entry.title }} Tickets" class="card card-md waves-effect waves-light" aria-label="{{ entry.title }} Tickets"&gt;
      {% if entry.eventPercentageSaving &gt; 0 %}
          &lt;div class="corner-ribbon top-right"&gt;{{ entry.eventPercentageSaving }}% Off&lt;/div&gt;
      {% endif %}
  
      {% set cardImage = entry.eventMediaTile[0] ?? null %}
      {% if cardImage %}
          &lt;div class="card-image"&gt;
              &lt;img src="{{ cardImage.geturl }}" alt="{{ entry.title }} Preview Image"&gt;
          &lt;/div&gt;
      {% endif %}
  
      &lt;div class="card-content"&gt;
          &lt;h3 class="card-title"&gt;{{ entry.title }}&lt;/h3&gt;
          &lt;p&gt;{{ entry.eventVenueName[0].title ?? 'N/A' }}, {{ entry.eventCity[0].title ?? 'N/A' }}&lt;/p&gt;
          &lt;div class="btn"&gt;From £{{ entry.eventMinimumPrice }}&lt;/div&gt;
      &lt;/div&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>If you turn the debug toolbar on your front-end (under your user's preferences) before implementing, and look at the query count, you should see a significant drop. </p>
  
  <p>If this isn't enough, you could <a href="https://docs.craftcms.com/v3/dev/tags/cache.html" rel="nofollow noreferrer">start caching</a>. Andrew has <a href="https://nystudio107.com/blog/the-craft-cache-tag-in-depth" rel="nofollow noreferrer">a great article</a> on this.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-13T13:52:13.507Z
Answers.LastActivityDate: 2020-03-13T13:52:13.507Z
Answers.UserDisplayName: Oli
Body: <p>I have the following category <a href="https://www.ticketstoday.co.uk/theatre" rel="nofollow noreferrer">https://www.ticketstoday.co.uk/theatre</a> which has around 600/700 Entries, this is paginated at 30x Entries a page. Unfortunately, it's loading rather slowly. It's not a huge entry count so I'm unsure what's happening.</p>
  
  <pre><code>  {% set entries = craft.entries ({
            section: 'events',
            limit: '30',
            order: 'postDate desc',
            with: ['eventMediaTile'],
            relatedTo: category
        }) %}
  
    {% paginate entries as pageInfo, pageEntries %}
    {% do seomatic.helper.paginate(pageInfo) %}
  
    {% for entry in pageEntries %}
      {% include '_card' %}
    {% endfor %}
  </code></pre>
  
  <p>Is there anything at all I can do to speed up the query, or, is it a limitation of Craft?</p>
  
  <blockquote>
    <p>Added Card Template below</p>
  </blockquote>
  
  <pre><code>&lt;a href="{{ entry.url }}" title="{{ entry.title }} Tickets" class="card card-md waves-effect waves-light" aria-label="{{ entry.title }} Tickets"&gt;
  {% if entry.eventPercentageSaving &gt; 0 %}
    &lt;div class="corner-ribbon top-right"&gt;{{ entry.eventPercentageSaving }}% Off&lt;/div&gt;
  {% endif %}
  {% for asset in entry.eventMediaTile %}
    &lt;div class="card-image"&gt;
      &lt;img src="{{ asset.geturl }}" alt="{{ entry.title }} Preview Image"&gt;
    &lt;/div&gt;
  {% endfor %}
  
  &lt;div class="card-content"&gt;
    &lt;h3 class="card-title"&gt;{{ entry.title }}&lt;/h3&gt;
    &lt;p&gt;{{ entry.eventVenueName.one().title ?? 'N/A' }}, {{ entry.eventCity.one().title ?? 'N/A' }}&lt;/p&gt;
    &lt;div class="btn"&gt;From £{{ entry.eventMinimumPrice }}&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/a&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-13T08:58:51.480Z
Comments.Text: Could you add the code you have in `{% include '_card' %}` to your question?
Comments.UserDisplayName: Oli
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-13T12:45:31.847Z
Comments.Text: Added the partial @Oli
Comments.UserDisplayName: JMKelley
Tags: <templating><performance>
Title: Slow Category Loading
ThreadText: # Slow Category Loading
  
  (Asked by: username_0 on 2020-03-12)
  
  I have the following category <https://www.ticketstoday.co.uk/theatre> which has around 600/700 Entries, this is paginated at 30x Entries a page. Unfortunately, it's loading rather slowly. It's not a huge entry count so I'm unsure what's happening.
  
  ```
    {% set entries = craft.entries ({
            section: 'events',
            limit: '30',
            order: 'postDate desc',
            with: ['eventMediaTile'],
            relatedTo: category
        }) %}
  
    {% paginate entries as pageInfo, pageEntries %}
    {% do seomatic.helper.paginate(pageInfo) %}
  
    {% for entry in pageEntries %}
      {% include '_card' %}
    {% endfor %}
  
  ```
  
  Is there anything at all I can do to speed up the query, or, is it a limitation of Craft?
  
  > Added Card Template below
  
  ```
  <a href="{{ entry.url }}" title="{{ entry.title }} Tickets" class="card card-md waves-effect waves-light" aria-label="{{ entry.title }} Tickets">
  {% if entry.eventPercentageSaving > 0 %}
    <div class="corner-ribbon top-right">{{ entry.eventPercentageSaving }}% Off</div>
  {% endif %}
  {% for asset in entry.eventMediaTile %}
    <div class="card-image">
      <img src="{{ asset.geturl }}" alt="{{ entry.title }} Preview Image">
    </div>
  {% endfor %}
  
  <div class="card-content">
    <h3 class="card-title">{{ entry.title }}</h3>
    <p>{{ entry.eventVenueName.one().title ?? 'N/A' }}, {{ entry.eventCity.one().title ?? 'N/A' }}</p>
    <div class="btn">From £{{ entry.eventMinimumPrice }}</div>
  </div>
  
  </a>
  
  ```
  
  **Tags:** templating, performance
  
  > **Comments:**
  > **username_1**: Could you add the code you have in `{% include '_card' %}` to your question?  
  > **username_0**: Added the partial @username_1  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-03-13. Score: 2 | Accepted answer
  
  You could [eager load](https://docs.craftcms.com/v3/dev/eager-loading-elements.html) a little more to speed things up. Especially your `eventVenueName` and `eventCity`
  
  For your query, try:
  
  ```twig
  {% set entries = craft.entries ({
          section: 'events',
          limit: '30',
          order: 'postDate desc',
          with: [
              'eventMediaTile',
              'eventVenueName',
              'eventCity'
          ],
          relatedTo: category }) %}
  
  ```
  
  Then in your `_card` do:
  
  ```twig
  <a href="{{ entry.url }}" title="{{ entry.title }} Tickets" class="card card-md waves-effect waves-light" aria-label="{{ entry.title }} Tickets">
      {% if entry.eventPercentageSaving > 0 %}
          <div class="corner-ribbon top-right">{{ entry.eventPercentageSaving }}% Off</div>
      {% endif %}
  
      {% set cardImage = entry.eventMediaTile[0] ?? null %}
      {% if cardImage %}
          <div class="card-image">
              <img src="{{ cardImage.geturl }}" alt="{{ entry.title }} Preview Image">
          </div>
      {% endif %}
  
      <div class="card-content">
          <h3 class="card-title">{{ entry.title }}</h3>
          <p>{{ entry.eventVenueName[0].title ?? 'N/A' }}, {{ entry.eventCity[0].title ?? 'N/A' }}</p>
          <div class="btn">From £{{ entry.eventMinimumPrice }}</div>
      </div>
  </a>
  
  ```
  
  If you turn the debug toolbar on your front-end (under your user's preferences) before implementing, and look at the query count, you should see a significant drop.
  
  If this isn't enough, you could [start caching](https://docs.craftcms.com/v3/dev/tags/cache.html). Andrew has [a great article](https://nystudio107.com/blog/the-craft-cache-tag-in-depth) on this.
  
  
  ---
  
  