Re: [Django] #26780: Prefetch objects don't work with slices

2022-09-05 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  Simon
 |  Charette
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  prefetch, slicing| Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by GitHub ):

 In [changeset:"69fa2e8eb25d9bdd395fa8857177d4637aaf4c55" 69fa2e8e]:
 {{{
 #!CommitTicketReference repository=""
 revision="69fa2e8eb25d9bdd395fa8857177d4637aaf4c55"
 Refs #26780 -- Made prefetch_related() don't use window expressions fo
 sliced queries if not supported.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018310efdabb-bed6f014-f088-4b00-8511-0271e275b9a8-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2022-08-15 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  Simon
 |  Charette
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  prefetch, slicing| Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"242499f2dc2bf24a9a5c855690a2e13d3303581a" 242499f2]:
 {{{
 #!CommitTicketReference repository=""
 revision="242499f2dc2bf24a9a5c855690a2e13d3303581a"
 Fixed #26780 -- Added prefetch_related() support for sliced queries.

 This was made possible by window function filtering support added in
 f387d024fc75569d2a4a338bfda76cc2f328f627.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182a0bea21e-8e004043-0ce0-40fe-b099-67040555db7d-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2022-08-15 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  Simon
 |  Charette
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182a09d87ea-7adcdf67-396b-4c6e-a85e-7603fe521436-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2022-08-13 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  Simon
 |  Charette
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * owner:  nobody => Simon Charette
 * status:  new => assigned
 * has_patch:  0 => 1


Comment:

 Submitted [https://github.com/django/django/pull/15922 a patch] that works
 on top of the currently under-review patch for #28333 and it was
 surprisingly very straightforward.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018295dd3569-afb37733-3311-4ed5-b211-e4408e4bdee4-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2022-07-31 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * cc: Simon Charette (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182576d335f-ea049e63-3f50-4a0e-8b3e-d9f9c68aa23e-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2022-07-31 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 As pointed out by others support for filter against window functions would
 allow `prefetch_related_objects` to use `Rank(partition_by)` to support
 this feature.

 If someone wants to give a shot at solving this particular issue before
 #28333 is resolved it should be doable by using a combination of
 `Queryset.raw` and `Query.compile` combinations.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018257486f4a-aa6a53b1-9dc1-4367-a47b-8e8b9f2820ab-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2022-07-22 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by şuayip üzülmez):

 * cc: şuayip üzülmez (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018227ed8556-81029193-c02a-444e-9db0-f0f5db626aa5-00%40eu-central-1.amazonses.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2021-12-13 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Arthur):

 Note that the solution above might not be portable to some MySql
 databases, with error

 `1235, "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME
 subquery'"`

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.e71a663088700a595f15e05727b6d912%40djangoproject.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2021-12-13 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Arthur):

 * cc: Arthur (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.4f56dace28c0db0f6464866ec9413404%40djangoproject.com.


Re: [Django] #26780: Prefetch objects don't work with slices

2019-07-10 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Pavel Lysak):

 * cc: Pavel Lysak (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6e58691c08b8a5e84ce379b5214a4c75%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2019-07-04 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by chex):

 * cc: chex (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6fe6a650199b2735cfc98e83d4f32db6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2019-07-02 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Dan LaManna):

 * cc: Dan LaManna (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.2dc12baf4db45aeb08422a4f0d10bf04%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2019-06-28 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by TZanke):

 * cc: TZanke (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.b0433ff18af5ad8b37a9621d2f1de1be%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2018-04-20 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Haseeb Ahmad):

 I think there is a workaround now to in django new version as we have
 OuterRef and Subquery.

 from django.db.models import OuterRef, Subquery

 User.objects.all().prefetch_related('comments',
 queryset=Comment.objects.filter(id__in=Subquery(
 Comment.objects.filter(user_id=OuterRef('user_id')).values_list('id',
 flat=True)[:5])))

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.f6e73cfbfac80f1ef25cbaa35c851185%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2017-12-12 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  Ludwik Trammer   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Jeff Johnson):

 I tried the filter by rank suggestion using Django 2.0 but I get this
 error:

 {{{
 django.db.utils.NotSupportedError: Window is disallowed in the filter
 clause.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.4939efd550d2acc6c33cd327b82385e9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2016-07-24 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by skyjur):

 If window queries are implemented
 (https://code.djangoproject.com/ticket/26608) then this use case could be
 possible in something similar to:


 {{{
 Prefetch(
 'post_set',
 queryset=
 Post.objects
 .annotate(_rank=Window(Rank(), partition_by='cateogry')
 .filter(_rank__lte=3)
 )
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.aebf9a491fc1d99956468ead5f743d32%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2016-07-22 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by asdator):

 The only way to limit this Query (and to not load all the records into
 memory) would be to is to do a `top-n-per-group` query which I don't think
 the `ORM` is capable of.

 What I can suggest is: Instead of limiting the `QuerySet`, find a way to
 filter it.

 For example, get only the `Posts` in the last day, week or a month (based
 on the post-frequency).

 {{{
 Category.objects.prefetch_related(Prefetch(
 'post_set',
 queryset=Post.objects.filter(
 date_published__gte=datetime.date.today()-timedelta(days=7)),
 to_attr='example_posts',
 ))
 }}}

 This way you won't load all the Posts into Memory.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.d5c39a9ac2125222e85253392a83cf69%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2016-06-20 Thread Django
#26780: Prefetch objects don't work with slices
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  prefetch, slicing| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by charettes):

 * type:  Bug => New feature
 * version:  1.9 => master
 * component:  Uncategorized => Database layer (models, ORM)
 * stage:  Unreviewed => Accepted


Comment:

 Tentatively accepting  but as you've noticed it would require a large
 refactor of the way prefetching is actually done.

 I could see `Category.objects.prefetch_related(Prefetch('articles',
 Article.object.order_by('-published_data')[0:3],
 to_attr='latest_articles'))` being useful but the underlying prefetch
 query would need to rely on subqueries, a feature the ORM is not good at
 for now.

 Maybe the addition of the [https://github.com/django/django/pull/6478
 Subquery] expression could help here.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.2ee3c90fc24b20475d248ec3dbc8d63a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2016-06-20 Thread Django
#26780: Prefetch objects don't work with slices
---+--
 Reporter:  ludwik |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Uncategorized  |  Version:  1.9
 Severity:  Normal |   Resolution:
 Keywords:  prefetch, slicing  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by ludwik):

 Charettes,

 Thank you for the reply.

 > accessing category.example_posts[:3] would have the same effect

 I'm pretty sure that is not correct. The end effect would obviously be the
 same, but the way it is achieved behind the scenes and the performance
 characteristics that follows would be widely different. What you propose
 (prefetching without limit, adding slicing in a loop after the fact) would
 make Django to perform a database query selecting '''all objects from the
 database table''' and loading them into memory. This would happen when the
 main queryset is evaluated (that's what prefetching is all about). Then
 the slicing would be perform by Python in memory, on a queryset that was
 already evaluated.

 That's what I understood from
 [https://docs.djangoproject.com/en/1.9/ref/models/querysets/#prefetch-
 objects the documentation] and also how Django actually behaved in an
 experiment I performed couple of minutes ago. What I want to avoid is
 exactly this behavior - loading thousands of objects from the database to
 display first three of them.

 I would be happy with a sane workaround, but to my knowledge there isn't
 any.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.230a9276ae27303d2f4230c0ae3ea0f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2016-06-19 Thread Django
#26780: Prefetch objects don't work with slices
---+--
 Reporter:  ludwik |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Uncategorized  |  Version:  1.9
 Severity:  Normal |   Resolution:
 Keywords:  prefetch, slicing  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by charettes):

 Hi ludwik,

 #26565 is about a different issue.

 The only way we could support slices would be to extract it from the
 provided it queryset to make it filterable again and apply it when in-
 memory joining. The prefect queryset would still have to fetch all results
 so I'm not sure it's worth the trouble as accessing
 `category.example_posts[:3]` would have the same effect.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.1fe3476de4777f3365ccef999be06a44%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices

2016-06-19 Thread Django
#26780: Prefetch objects don't work with slices
---+--
 Reporter:  ludwik |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Uncategorized  |  Version:  1.9
 Severity:  Normal |   Resolution:
 Keywords:  prefetch, slicing  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by ludwik):

 It seems to me that #26565 ("Allow Prefetch query to use .values()") is
 related.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6e14c0e82ecc9eb89b8ec6a843f2a825%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26780: Prefetch objects don't work with slices (was: Prefetch objects doesn't work with slices)

2016-06-19 Thread Django
#26780: Prefetch objects don't work with slices
---+--
 Reporter:  ludwik |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Uncategorized  |  Version:  1.9
 Severity:  Normal |   Resolution:
 Keywords:  prefetch, slicing  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by ludwik):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.da5cc5a837e1c9874018ba4331871d70%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.