Re: Solving the select+1 problem.

2014-06-11 Thread Stratos Moros
Given their sample code, my initial impression was that it was indeed 
automatic. Looking a bit closer, there seems to be hardcoded logic 
inside the DataSource (the thing I'm assuming provides getAllUserIds and 
getUsernameById) to specifically fetch all ids and then all names for 
those ids. So they're still doing a manual prefetch_related equivalent 
but at a different abstraction level.


I should note that my Haskell knowledge is also minimal, so it is quite 
possible that I'm misunderstanding something.



On 11 Jun 2014, at 17:36, Alex Gaynor wrote:

I also do not really know Haskell (I'm sensing a trend...), that said, 
it
seems to me the cool part of haxl is that it can be automatic -- 
analagous

to if writing {{ post.author.name }} in a template caused
select_related("author") to automatically be applied to the queryset 
that

yielded post.

Alex


On Wed, Jun 11, 2014 at 6:37 AM, Jacob Kaplan-Moss 


wrote:

I'm not great at Haskell, either, but this looks to me to be very 
similar

to prefetch_related (
https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related
).

Jacob


On Wed, Jun 11, 2014 at 6:15 AM, Jonathan Slenders <
jonathan.slend...@gmail.com> wrote:

The "select+1" problem is a problem that people often face in 
Django.

Usually, something like select_related solves it, but I don't think
that's always possible.

Facebook released Haxl today and there's an example of their apprach 
to

the problem.
https://github.com/facebook/Haxl/tree/master/example/sql

I don't know enough Haskel to understand this code, but it could 
contain

some very nice ideas that apply to our ORM as well.

Cheers,
Jonathan

--
You received this message because you are subscribed to the Google 
Groups

"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, 
send an

email to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-developers@googlegroups.com.
Visit this group at 
http://groups.google.com/group/django-developers.

To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/f81a5db1-9777-4cd0-98b7-25b0bc44f498%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google 
Groups

"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, 
send an

email to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-developers@googlegroups.com.

Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/CAK8PqJFJoOXVbOX7C7NmhToVsEizD2ZvWCS1vv_LZpfdRv2ayg%40mail.gmail.com

.

For more options, visit https://groups.google.com/d/optout.





--
"I disapprove of what you say, but I will defend to the death your 
right to

say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

--
You received this message because you are subscribed to the Google 
Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-developers@googlegroups.com.

Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFRnB2UAGp%2BWPJHm_oq9WLFv5yTvtVT5%3Drs6E46WinL49Q%2B1wA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/B3FF8C5C-70FA-4781-95A9-2E06CF618AF2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Solving the select+1 problem.

2014-06-11 Thread Alex Gaynor
I also do not really know Haskell (I'm sensing a trend...), that said, it
seems to me the cool part of haxl is that it can be automatic -- analagous
to if writing {{ post.author.name }} in a template caused
select_related("author") to automatically be applied to the queryset that
yielded post.

Alex


On Wed, Jun 11, 2014 at 6:37 AM, Jacob Kaplan-Moss 
wrote:

> I'm not great at Haskell, either, but this looks to me to be very similar
> to prefetch_related (
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related
> ).
>
> Jacob
>
>
> On Wed, Jun 11, 2014 at 6:15 AM, Jonathan Slenders <
> jonathan.slend...@gmail.com> wrote:
>
>> The "select+1" problem is a problem that people often face in Django.
>> Usually, something like select_related solves it, but I don't think
>> that's always possible.
>>
>> Facebook released Haxl today and there's an example of their apprach to
>> the problem.
>> https://github.com/facebook/Haxl/tree/master/example/sql
>>
>> I don't know enough Haskel to understand this code, but it could contain
>> some very nice ideas that apply to our ORM as well.
>>
>> Cheers,
>> Jonathan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-developers@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/f81a5db1-9777-4cd0-98b7-25b0bc44f498%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAK8PqJFJoOXVbOX7C7NmhToVsEizD2ZvWCS1vv_LZpfdRv2ayg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFRnB2UAGp%2BWPJHm_oq9WLFv5yTvtVT5%3Drs6E46WinL49Q%2B1wA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Solving the select+1 problem.

2014-06-11 Thread Jacob Kaplan-Moss
I'm not great at Haskell, either, but this looks to me to be very similar
to prefetch_related (
https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related
).

Jacob


On Wed, Jun 11, 2014 at 6:15 AM, Jonathan Slenders <
jonathan.slend...@gmail.com> wrote:

> The "select+1" problem is a problem that people often face in Django.
> Usually, something like select_related solves it, but I don't think that's
> always possible.
>
> Facebook released Haxl today and there's an example of their apprach to
> the problem.
> https://github.com/facebook/Haxl/tree/master/example/sql
>
> I don't know enough Haskel to understand this code, but it could contain
> some very nice ideas that apply to our ORM as well.
>
> Cheers,
> Jonathan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/f81a5db1-9777-4cd0-98b7-25b0bc44f498%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Solving the select+1 problem.

2014-06-11 Thread Jonathan Slenders
The "select+1" problem is a problem that people often face in Django.
Usually, something like select_related solves it, but I don't think that's 
always possible.

Facebook released Haxl today and there's an example of their apprach to the 
problem.
https://github.com/facebook/Haxl/tree/master/example/sql

I don't know enough Haskel to understand this code, but it could contain 
some very nice ideas that apply to our ORM as well.

Cheers,
Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f81a5db1-9777-4cd0-98b7-25b0bc44f498%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.