Stored procedures, at least with MSSQL, provide another way of returning multiple result sets with a single SQL statement. The queries will be parsed and executed faster due to stored procedures being parsed and compiled when created, instead of when executed. A stored procedure will also allow you to get more complex results with a few simple queries, instead of a single complex query.
Using stored procedures adds complexity to a Django project and should be used sparingly. From my personal experience, the extra server resources to have more instances running to service requests is usually better than having the extra complexity of using stored procedures in a Django project. Regards, Michael Manfre On Fri, Feb 27, 2015 at 2:46 PM, Tom Evans <tevans...@googlemail.com> wrote: > On Fri, Feb 27, 2015 at 3:19 PM, aRkadeFR <cont...@arkade.info> wrote: > > What do you mean by a single roundtrip? > > He means asking the database server to consider multiple queries > (concurrently?), and return data once all of them are available. In > pseudo code: > > people, jobs, cities = DB.fetch_multi( > Person.objects.all(), > Job.objects.all(), > City.objects.all()) > > MySQL's C API supports executing multiple SQL statements in a single > round trip, the data sets are made available in turn to the client API > > http://dev.mysql.com/doc/refman/5.7/en/c-api-multiple-queries.html > > however, each statement is executed in turn, not concurrently, so the > only speed up you would have is that there is only one query to parse, > and a few small packets less sent to the database server... The > database connection is not torn down between requests to the database. > > The only way I could see it having any non-marginal effect is if you > have high latency to your database server. But then you have a lot of > problems. > > Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" 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/CAFHbX1%2BMgfwHL%3DL8hjgRMyf%2B2-Rap9L01PF9cxERFqU6c8uHdA%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 (Contributions to Django itself)" 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/CAGdCwBuxXXSTrB68YFQ503RAfxH1z_BBxpytLk-75gwuGs3-zw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.