My previous email was pretty bad. I actually had two different things to bring up, but I had conflated them into one thing that was poorly thought out and difficult to understand. Here's one of those issues, with a little more clear thought this time.
Problem: Debug pages sometimes load very slowly. Cause: The local variable display unintentionally evaluates QuerySets, causing many expensive database hits. Resolution: Don't evaluate QuerySets whose results aren't yet cached. I talked this over with Mike Axiak from MIT ESP, who actually implemented a solution. I've submitted #6748 with a patch [1], refactoring his code to be more suitable to general inclusion. Current issues: 1. Currently the repr() of an unevaluated QuerySet returns the SQL. This may be useful in some cases, but maybe not in general. Malcolm was concerned about the SQL possibly including sensitive data. I'd wonder what sensitive data the filters would have that the evaluated QuerySet repr wouldn't also reveal, but there's a valid underlying point: not everyone will want the same debug template results. I'll give a proposal addressing this issue in general shortly. 2. The check for cached results may not work with qs-refactor, but it's probably easily fixed. 3. The patch doesn't address a more pernicious issue: a model's repr may include data from a foreign key relation, which will hit the database in general. So even an already-evaluated QuerySet may be unsafe to repr, from the standpoint of still accessing the database. It's more pernicious because a well-normalized collection of related objects may result in hundreds of little queries. I'm not sure how to solve this. [1] http://code.djangoproject.com/attachment/ticket/6748/django-safereprqueryset-in-debug.patch I've tested this lightly; it still could use some shakedown. Thoughts? Better understood this time? -Ken --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---
