Hi all, I'm trying the famous Django tutorial: http://docs.djangoproject.com/en/1.1/intro/
Playing with "polls" and "choices" I see lot of SQL queries this application creates. Actually, I just selected a list of polls than selected the poll with ID=2, than voted for a choice. Here are details (SQL's recorded using "debug_toolbar", may be a database log will show something else): *************************************************************************************************** polls/ One select: SELECT "polls_poll"."id", "polls_poll"."question", "polls_poll"."pub_date" FROM "polls_poll" polls/2/ Two selects: SELECT "polls_poll"."id", "polls_poll"."question", "polls_poll"."pub_date" FROM "polls_poll" WHERE "polls_poll"."id" = 2 SELECT "polls_choice"."id", "polls_choice"."poll_id", "polls_choice"."choice", "polls_choice"."votes" FROM "polls_choice" WHERE "polls_choice"."poll_id" = 2 polls/2/vote/ Three selects, one update SELECT "polls_poll"."id", "polls_poll"."question", "polls_poll"."pub_date" FROM "polls_poll" WHERE "polls_poll"."id" = 2 SELECT "polls_choice"."id", "polls_choice"."poll_id", "polls_choice"."choice", "polls_choice"."votes" FROM "polls_choice" WHERE ("polls_choice"."poll_id" = 2 AND "polls_choice"."id" = 10 ) SELECT (1) AS "a" FROM "polls_choice" WHERE "polls_choice"."id" = 10 UPDATE "polls_choice" SET "poll_id" = 2, "choice" = E'choice2', "votes" = 29 WHERE "polls_choice"."id" = 10 polls/2/results/ Again, two selects SELECT "polls_poll"."id", "polls_poll"."question", "polls_poll"."pub_date" FROM "polls_poll" WHERE "polls_poll"."id" = 2 SELECT "polls_choice"."id", "polls_choice"."poll_id", "polls_choice"."choice", "polls_choice"."votes" FROM "polls_choice" WHERE "polls_choice"."poll_id" = 2 *************************************************************************************************** It seems, same records are selected several time. With some sort of caching this could be greatly improved. May be some built-in Django tools (like select_related()? ) can help here? I now, number of cache implementations exists (like this http://github.com/mmalone/django-caching/ and this http://github.com/dcramer/django-orm-cache ) but I would like to use built-in Django instruments first. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.