The main problem with depth=1 seems to be, that the query generator still spans over too many tables (watching the mysql.log i can see tables fully joined that definitvly do not belong to level 1). Thus the returned data set will surely confuse django.
Looking at django/db/models/query.py reveals: def fill_table_cache(opts, select, tables, where, old_prefix, cache_tables_seen, max_depth=0, cur_depth=0): """ Helper function that recursively populates the select, tables and where (in place) for select_related queries. """ # If we've got a max_depth set and we've exceeded that depth, bail now. if max_depth and cur_depth > max_depth: return None [ ... ] fill_table_cache(f.rel.to._meta, select, tables, where, db_table, cache_tables_seen, max_depth, cur_depth+1) So by just looking at it one can see that with max_depth=1 and cur_depth initialized to zero the code will recurse into level 2, generating a too broad query. declaring def fill_table_cache(opts, select, tables, where, old_prefix, cache_tables_seen, max_depth=0, cur_depth=1): fixes things for me. Interestingly enough the same observation doesnt seem to yield for def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0): It seems to be neccessary within this function to go one level deeper... I am commenting rev 4661. Boris On 11 Jan., 13:52, "David Cramer" <[EMAIL PROTECTED]> wrote: > It still seems to have a bug when just doing .select_related(depth=1), > sometimes its filling the field w/ the wrong data, looking into it. > > On Jan 11, 11:31 am, "David Cramer" <[EMAIL PROTECTED]> wrote: > > > I retract my statement, we had some other random server configuration > > error that just happened to appear at the same time as us putting this > > live :) > > > On Jan 10, 8:34 pm, "David Cramer" <[EMAIL PROTECTED]> wrote: > > > > It seems there are some issues with the code. Although I'm not sure why > > > it's happening, this was causing servers to get extremely loaded, and > > > the SQL queries werent executing properly. I had no issues when running > > > it on runserver before we pushed it onto a live environment though. > > > > Going to look into it some more tomorrow, if anyone has any ideas let > > > me know. > > > > On Jan 10, 5:45 pm, Michael Radziej <[EMAIL PROTECTED]> wrote: > > > > > David Cramer schrieb: > > > > > > I can do the docs, but it'd be a great time saver if you could do the > > > > > tests. I'm up to my elbows in work at the moment so :)Fine for me, > > > > > then I take the tests. > > > > > Michael > > > > > -- > > > > noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - > > > > Tel +49-911-9352-0 - Fax +49-911-9352-100 > > > > >http://www.noris.de-TheIT-OutsourcingCompany --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---