Changes between Initial Version and Version 5 of Ticket #7121
- Timestamp:
- Jun 16, 2008, 11:29:39 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #7121
- Property Summary queryset-rf does not always honor cache → Slicing on QuerySet bypasses result_cache
- Property Keywords qsrf-cleanup added
-
Ticket #7121 – Description
initial v5 2 2 3 3 Method a) 4 4 {{{ 5 5 list = Article.objects.filter(id__gt=130).order_by('-id')[0:2] 6 6 list[0] # Performs SQL query with LIMIT 1 7 7 list[1] # Performs another SQL query with LIMIT 1 OFFSET 2 8 }}} 8 9 9 10 Method b) 10 11 12 {{{ 11 13 list = Article.objects.filter(id__gt=130).order_by('-id')[0:2] 12 14 list # Performs an SQL query with LIMIT 2 13 15 list[0] # Hits the cache 14 16 list[1] # Hits the cache 17 }}} 15 18 19 Calling {{{list[0]}}} afterwards will invoke the SQL query with LIMIT 1 20 Calling {{{list[1]}}} after this will invoke another query with LIMT 1 OFFSET 1 16 21 17 Calling list[0] afterwards will invoke the SQL query with LIMIT 1 18 Calling list[1] after this will invoke another query with LIMT 1 OFFSET 1 19 20 b) Calling just "list" afterwards first and then calling list[0] and list[1] 22 b) Calling just "list" afterwards first and then calling {{{list[0]}}} and {{{list[1]}}} 21 23 will honor the cache and therefore only one SQL query gets fired. 22 24