On Feb 7, 9:44 pm, dw314159 <dw314...@gmail.com> wrote: > Django gurus: > > Hello, I am experiencing very slow performance with Django when > connected to an Oracle database. The exact same Django application > runs far faster with PostgreSQL and SQLite, with the same source data > loaded into each database. Looking at the information embedded in > “connection.queries” after making an Oracle query through Django, it > appears that the queries themselves run very quickly (runtimes are > comparable to those measured with PostgreSQL and SQLite), but the > whole turnaround time for a query in Oracle far exceeds the reported > query time. > > I’ve tried the built-in Oracle backend engine and django-oraclepool > 0.7; neither improve performance. (With django-oraclepool, I also gave > sufficient time for the connections to pool before taking > measurements). Using cx_Oracle outside of Django on the same > workstation to connect to the same Oracle database, the query > turnaround time is very quick. > > Is this problem connected to the fact that Django is reported to drop > the database connection between queries, and therefore must reconnect > to Oracle every time a query is executed? Or is there a Django > configuration option that must be specified to make the best use of > Oracle?
Django actually closes the connection after each HTTP request, not each individual query. This means that if you were running your timing tests in a request-less environment (i.e. through the Django shell), you would not expect to see any slowdown caused by this. It also means that if you are running more than a few queries to serve each request, the overall effect may be less noticeable. Have you tried tracing the code during a request? It would be helpful to have at least a general idea of where it's spending so much time. Cheers, Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.