Hi,

I'm trying to figure out why a certain view is taking a long time to
render.  It all comes down to DB access, but here's where I'm starting
to get confused.  Looking at connections[].queries, I can see that the
query in question takes around 300s to execute (does this include
re-hydration time as well?).  However, if I take this Django generated
query and run it against the database (MS SQL Server) directly (using
Management Studio), the results come back in around 10s.  The query
returns a single column table with 23 rows.  Below are also profiler
data for the view call.  Can anyone offer any theories why such a
disparity in execution times?  I can post additional code if need be,
just let me know.


Thanks
Dmitry


         72237 function calls (67692 primitive calls) in 1094.100 CPU seconds

   Ordered by: internal time, call count
   List reduced from 225 to 30 due to restriction <30>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        4 1092.705  273.176 1092.706  273.177
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:308(execute)
 2121/303    0.252    0.000    0.748    0.002
c:\python26\lib\site-packages\django\db\models\query.py:1120(get_cached_row)
     2122    0.221    0.000    0.381    0.000
c:\python26\lib\site-packages\django\db\models\base.py:251(__init__)
    11542    0.142    0.000    0.175    0.000
c:\python26\lib\site-packages\sql_server\pyodbc\compiler.py:37(convert_values)
      327    0.097    0.000    0.277    0.001
c:\python26\lib\site-packages\sql_server\pyodbc\compiler.py:69(resolve_columns)
        4    0.081    0.020    0.085    0.021
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:140(_cursor)
    11552    0.068    0.000    0.068    0.000
c:\python26\lib\site-packages\django\db\models\query_utils.py:222(select_related_descend)
        9    0.057    0.006    0.065    0.007
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:349(fetchmany)
     4245    0.051    0.000    0.124    0.000
c:\python26\lib\site-packages\django\dispatch\dispatcher.py:143(send)
     8515    0.049    0.000    0.049    0.000
c:\python26\lib\site-packages\django\db\models\options.py:200(_fields)
     4244    0.045    0.000    0.045    0.000
c:\python26\lib\site-packages\django\dispatch\dispatcher.py:11(_make_id)
  1404/60    0.032    0.000    0.068    0.001
c:\python26\lib\copy.py:144(deepcopy)
     2122    0.028    0.000    0.048    0.000
c:\python26\lib\site-packages\django\dispatch\dispatcher.py:208(_live_receivers)
     3644    0.021    0.000    0.021    0.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:252(get_internal_type)
      330    0.019    0.000 1093.215    3.313
c:\python26\lib\site-packages\django\db\models\sql\compiler.py:666(results_iter)
     2424    0.016    0.000    0.016    0.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:249(get_cache_name)
     2122    0.012    0.000    0.012    0.000
c:\python26\lib\site-packages\django\db\models\base.py:244(__init__)
      306    0.012    0.000    1.222    0.004
c:\python26\lib\site-packages\django\db\models\query.py:213(iterator)
     1365    0.011    0.000    0.011    0.000
c:\python26\lib\copy.py:261(_keep_alive)
     1818    0.010    0.000    0.010    0.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:224(unique)
      606    0.008    0.000    0.011    0.000
c:\python26\lib\site-packages\django\db\models\fields\related.py:275(__get__)
      328    0.008    0.000    0.008    0.000
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:326(format_results)
    625/4    0.008    0.000    0.032    0.008
c:\python26\lib\site-packages\django\db\models\fields\subclassing.py:45(inner)
        1    0.008    0.008 1094.100 1094.100
u:\qpsitools.trunk\src\scanner\crtracker\views.py:195(productlines)
   124/75    0.007    0.000    0.056    0.001
c:\python26\lib\copy.py:224(_deepcopy_list)
  618/198    0.007    0.000    0.013    0.000
c:\python26\lib\json\encoder.py:284(_iterencode)
     1217    0.006    0.000    0.006    0.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:545(get_internal_type)
      307    0.006    0.000    0.010    0.000
c:\python26\lib\site-packages\django\db\utils.py:122(_route_db)
     1212    0.006    0.000    0.006    0.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:973(get_internal_type)
     1054    0.005    0.000    0.005    0.000
c:\python26\lib\copy.py:197(_deepcopy_atomic)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to