2

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?

  • Have you tried implementing the {% cache %}{% endcache %} tags? – darylknight Apr 21 '15 at 13:07
  • 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 Apr 21 '15 at 13:25
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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.