On Wed, Feb 4, 2009 at 3:01 AM, Bartek SQ9MEV <[email protected]> wrote:
> > Bartek pisze: > > > so... looks like everytime I need 20 Post items my database is hit by > > query returning all records... I find it a big overhead, and my app > > suffers from that... > Today I'm still investigating this issue, and I've just tried to use > Paginator object as described at > http://docs.djangoproject.com/en/dev/topics/pagination/#topics-pagination > with my Post model described ina my previous post. Funny thing is that > it's OK - Not so funny -- this is what I'd expect. This is one of the main reasons for using pagination, to limit the query results to a manageable size. > sql for any page is: > > SELECT "galgather_post"."id", "galgather_post"."group_id", > "galgather_post"."messageid", "galgather_post"."subject", > "galgather_post"."author_id", "galgather_post"."posting_date", > "galgather_post"."date_added" FROM "galgather_post" ORDER BY > "galgather_post"."posting_date" DESC LIMIT 10 OFFSET 10 > > triggered by: > posts=Post.objects.all() > p=Paginator(posts,10) > page2=p.page(2) > page2.object_list > > So, any idea where's the clue? > Is it possible to use django-pagination with generic views without so > senseless overhead? > You've got one test using base Django pagination routines that works correctly, one using django-pagination that apparently issues an unrestricted query, so it sounds like there's a problem in django-pagination. I assume you are using the latest of that? I'd open an issue on its project page. You could also try to track down where in django-pagination the unrestricted query is coming from and provide a fix.... Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

