> Den 17/09/2015 kl. 09.22 skrev Javier Guerra Giraldez <jav...@guerrag.com>: > > On Thu, Sep 17, 2015 at 2:07 AM, Erik Cederstrand > <erik+li...@cederstrand.dk> wrote: >>> Den 16/09/2015 kl. 16.45 skrev Mike Dewhirst <mi...@dewhirst.com.au>: >>> >>> On 16/09/2015 9:53 AM, Erik Cederstrand wrote: >>>> issues because the prefetch query does something along the lines of >>>> "SELECT ... FROM lesson_subjects WHERE lesson_id IN >>>> [insane_list_of_lesson_ids]". >>> >>> I'm no expert so I'm wondering if len([insane_list_of_lesson_ids]) == >>> "hundreds of thousands"? >> >> In my, case, yes. I think the backend might process the query in chunks if >> the length of the SQL exceeds the max SQL query size. > > > Just curious, which RDBMS are you using? I remember that on MySQL > there used to be an advice to populate a temporary table and do a JOIN > instead of very big `xxx IN (yyyy)` statements. I'm not sure if > there's a hard limit, but anything over a few hundreds would be better > with JOIN than with IN(...)
I'm using PostgreSQL and yes, I'm sure there are techniques to work around huge IN clauses. It just seems plain wrong to send 1-2MB of textual SQL to an SQL server when my original filters should work just fine, and hopefully much faster. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6FC97256-8DC7-4E68-ACDA-FCD459F5D519%40cederstrand.dk. For more options, visit https://groups.google.com/d/optout.