ridethepony/django-fiber — pull request #47 by spookylukey (2012-01-16 22:15:19+00:00)
Title: Query count reduction

These commits reduce the query count for the example project from 30 to 23 (for the home page, logged out).

One of the queries removed is a query in show_menu that loaded almost the entire Page table:

SELECT "fiber_page"."id", "fiber_page"."created", "fiber_page"."updated", "fiber_page"."parent_id", "fiber_page"."title", "fiber_page"."url", "fiber_page"."redirect_page_id", "fiber_page"."mark_current_regexes", "fiber_page"."template_name", "fiber_page"."show_in_menu", "fiber_page"."is_public", "fiber_page"."protected", "fiber_page"."metadata", "fiber_page"."lft", "fiber_page"."rght", "fiber_page"."tree_id", "fiber_page"."level" FROM "fiber_page" WHERE ("fiber_page"."is_public" = True AND "fiber_page"."show_in_menu" = True ) ORDER BY "fiber_page"."tree_id" ASC, "fiber_page"."lft" ASC

(Note the lack of any LIMIT here).

I'm also going to have a go at show_menu (see issue #12), but that will take more work.