--
Ticket URL: <https://code.djangoproject.com/ticket/18330>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
Seems like a good approach.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:1>
* needs_better_patch: 0 => 1
Comment:
I'm making a few improvements to the implementation.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:2>
* needs_better_patch: 1 => 0
Comment:
Happier with this rendition of the patch. Read to be moved forward in the
process. I don't have an Oracle backend to test against and only compared
that backend's generated SQL against the previously known working syntax.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:3>
* owner: nobody => manfre
Comment:
''raw_limit_offset_select'' will need a "where" argument because unit test
"''aggregation_regress.AggregationTests.test_annotate_with_extra''" also
has hand written limit query.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:4>
Comment (by manfre):
Updated patch to add ''where'' argument to allow more useful queries and
udpated the hand coded limit query in unit test
''aggregation_regress.AggregationTests.test_annotate_with_extra'' to use
''raw_limit_offset_select()''.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:5>
Comment (by akaariai):
I am going to look if we could use the Django ORM directly in the dbcache
case. The second use of limit in aggregation_regress can be easily
removed. If the ORM idea works out (basically create a model in flight)
then there is no need to run any LIMIT queries at all.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:6>
Comment (by akaariai):
I created ticket #18401 to track the db cache backend issue. If that gets
in core, then there is just the lone aggregation_regress problem left, and
that should be easy to correct (by for example fetching the PK in separate
query, then using where pk = pk in the raw SQL query). This way there is
hopefully no need for a new backend method.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:7>
Comment (by aaugustin):
This was suggested in #15580, before I fixed that problem inappropriately
in #16481. It would be interesting to compare the patch on this ticket and
on #15580 (which was written by a core dev but not committed).
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:8>
Comment (by akaariai):
In my opinion there are two ways forward for this ticket: the method
suggested by Ian Kelly in #15580: that is, a database operation "sql for
cache cull". Or, to go with ORM-based cache db backend, likely with raw
SQL for the read-only operations for performance reasons (#18401).
The good thing about the #15580 is that it is simple and solves the
current situation. The good thing about #18401 is that it reuses existing
ORM code, and cleans up the implementation of cache table creation and
cache operations.
If it isn't obvious by now I favor using the ORM for the cache tables. Of
course, this decision isn't that important, and I can easily live with the
#15580 approach, too.
My suggestion is to use the ORM for everything else except for the
has_key() and get() operations in the cache backend. The hard parts of
this ticket would be solved by that, and the cache backend implementation
would be cleaner, too. There is no performance loss for any realistic use
case.
I will wait for some time for comments to this plan.
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:9>
Comment (by akaariai):
I will go with the idea in #15580. I do think using the ORM for cache
tables will make DRYer and cleaner code. We have an ORM which is designed
to generate queries in cross-backend compatible way, so using the existing
machinery here seems like a good idea. But as I haven't heard any other
opinions here, I am going to go with what Russell suggested in #18401 (use
#15580's approach).
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:10>
* owner: manfre => akaariai
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:11>
* status: new => closed
* resolution: => fixed
Comment:
In [d3c2eb103f6682c029a850e60dc4cf85896b6aa2]:
{{{
#!CommitTicketReference repository=""
revision="d3c2eb103f6682c029a850e60dc4cf85896b6aa2"
Fixed #18330 - Made cache culling 3rd party db backend friendly
This is Ian Kelly's patch from #15580 with minor modifications.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/18330#comment:12>