How pagination affects performance

I am working on a kind of medium-size website where we have many posts (when I say many I talk about millions of posts).

Because posts are shown to users according to their preferences; the list of posts changes for every user. We used a Digg style pagination with the paginators provided by django, but the problem was that those paginators perform “SELECT COUNT(*) …” queries and when you have complex querysets and many rows; that queries are really expensive, making the complete application very slow.

Since we knew in this case users don’t care about the total number of objects or pages there was no need to use that “counts” so we decided to use django endless pagination http://code.google.com/p/django-endless-pagination/ Now our database is not exhausted anymore and the site is very quick now. Also, the installation and configuration was so easy that just took some minutes.

I’m really glad these guys built endless pagination, you should definitely give it a try.

1 Response to “How pagination affects performance”


  1. 1 Phuong Nguyen August 15, 2011 at 5:40 am

    That’s cool!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.