Regarding queries cache... but not in the way almost everyone usually thinks of this cache (for caching the queries results) ...but cache for the actual queries themselves, for the query tree generated by django, the Query object itself.
Has anyone thought of this? Much in the same way the cache loader for templates works, but for queries? I've come across the need to cache the query tree since it was taking a lot of time for django to build the query trees for a few "complex" queries ...and once I cached the query tree, I then later only injected to the tree the values that were needed for each filter. The problem with my approach is I have to cache a query tree for each different set of filters for the query, still however, since its uncommon for the number and type of filters (and excludes and options) to be dynamic, the cache works. For example, if I had a query like this: MyModel.objects.filter(base="base", Q(name__stuff__id__in=[10, 12, 13]) | Q(name__stuff__mode="green")).exclude(type__name="plastic") And I use it *a lot*, django takes too long to build a tree for it every time, and that time is ever increasing for more and more implement queries too. However, if I cache the tree generated for that particular query with the set of filters and excludes, at a later time I can reuse the query object by simply injecting the different new values needed into the tree, to be used instead of the originals: "base", [10, 12, 13], "green", and "plastic". I did this in a very crude way, but it worked. It *significantly* reduced the time my queries took. For my strategy I created a function to inject said values to the query tree. If anyone funds this interesting, I can elaborate an provide some code. German M Bravo -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.