<p>Add the following tags around your <code>{% pagination %}</code></p>

<pre><code>{% cache %}
{% endcache %}
</code></pre>

<p>Those tags will refresh every time the content changes, and when the content hasn't changed, it'll reduce your database queries significantly.</p>

<p>For more info see:</p>

<ul>
<li><a href="http://buildwithcraft.com/docs/templating/cache" rel="nofollow noreferrer">The craft docs</a></li>
<li><a href="https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag">What are the best practices for using the cache tag</a></li>
</ul>

CC BY-SA 3.0
2015-04-21T13:57:02.447Z
2015-04-21T13:57:02.447Z
2017-04-13T12:50:59.930Z
darylknight
<p>I was wondering if anyone else has experienced a serious performance hit when implementing pagination?</p>

<p>By just using Safari's timeline, I can see my page takes 500ms to generate.  After introducing JUST the paginate tag (not including any loops etc), it now takes 1.5s!  </p>

<p>Is this normal behaviour?  If not, what should I be doing to improve the performance?</p>

<p>Thanks</p>

<p>EDIT:  Thanks for the suggestions regarding caching.  I am aware of the cache tag however, the paginated entries are the results of a search query with various filters so I'm concerned that the caching will have little effect.  Or am I wrong?</p>

CC BY-SA 3.0
2015-04-21T13:07:48.487Z
Have you tried implementing the {% cache %}{% endcache %} tags?
darylknight
CC BY-SA 3.0
2015-04-21T13:25:02.537Z
I'll second @DarylKnight's comment - depending on what you are paginating, you might be making some pretty hefty database queries. {% cache %} tags will help!
Aaron Berkowitz
<performance><pagination>
Paginate performance issue
# Paginate performance issue

(Asked by: username_0 on 2015-04-21)

I was wondering if anyone else has experienced a serious performance hit when implementing pagination?

By just using Safari's timeline, I can see my page takes 500ms to generate. After introducing JUST the paginate tag (not including any loops etc), it now takes 1.5s!

Is this normal behaviour? If not, what should I be doing to improve the performance?

Thanks

EDIT: Thanks for the suggestions regarding caching. I am aware of the cache tag however, the paginated entries are the results of a search query with various filters so I'm concerned that the caching will have little effect. Or am I wrong?

**Tags:** performance, pagination
> **Comments:**
> **username_1**: Have you tried implementing the {% cache %}{% endcache %} tags?  
> **username_2**: I'll second @DarylKnight's comment - depending on what you are paginating, you might be making some pretty hefty database queries. {% cache %} tags will help!  

---

## 1 answers

### Answer by username_1 on 2015-04-21. Score: 1

Add the following tags around your {% pagination %}
{% cache %}
{% endcache %}

Those tags will refresh every time the content changes, and when the content hasn't changed, it'll reduce your database queries significantly.
For more info see:

The craft docs
What are the best practices for using the cache tag


---

