The columns only contain address strings and not much more.
Okay I did some profiling for the customerorder plus two joins on
itemsbought and products:
1008030 function calls (968253 primitive calls) in 2.220 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 2.211 2.211 sqltest.py:151(test)
1 0.008 0.008 2.190 2.190
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py:2294(all)
1 0.000 0.000 1.319 1.319
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py:2407(__iter__)
1 0.000 0.000 1.312 1.312
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py:2421(_execute_and_instances)
4 0.000 0.000 1.303 0.326
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py:661(execute)
1 0.000 0.000 1.300 1.300
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/sql/elements.py:320(_execute_on_connection)
1 0.000 0.000 1.300 1.300
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py:790(_execute_clauseelement)
4 0.000 0.000 1.298 0.324
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py:877(_execute_context)
9 0.000 0.000 1.293 0.144
/home/dumbass/sources/venv/lib/python2.7/site-packages/MySQLdb/cursors.py:164(execute)
7 0.000 0.000 1.293 0.185
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/engine/default.py:435(do_execute)
9 0.000 0.000 1.293 0.144
/home/dumbass/sources/venv/lib/python2.7/site-packages/MySQLdb/cursors.py:353(_query)
1709 0.010 0.000 0.864 0.001
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/loading.py:27(instances)
22084/5537 0.248 0.000 0.778 0.000
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/loading.py:330(_instance)
22052/5537 0.122 0.000 0.694 0.000
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/loading.py:284(populate_state)
9 0.000 0.000 0.685 0.076
/home/dumbass/sources/venv/lib/python2.7/site-packages/MySQLdb/cursors.py:358(_post_get_result)
9 0.000 0.000 0.684 0.076
/home/dumbass/sources/venv/lib/python2.7/site-packages/MySQLdb/cursors.py:324(_fetch_row)
9 0.206 0.023 0.684 0.076 {built-in method fetch_row}
9 0.000 0.000 0.608 0.068
/home/dumbass/sources/venv/lib/python2.7/site-packages/MySQLdb/cursors.py:315(_do_query)
3829 0.009 0.000 0.426 0.000
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/strategies.py:1451(load_collection_from_joined_existing_row)
111604 0.073 0.000 0.409 0.000
/home/dumbass/sources/venv/lib/python2.7/site-packages/MySQLdb/connections.py:212(string_decoder)
10979/5505 0.016 0.000 0.344 0.000
/home/dumbass/sources/venv/lib/python2.7/site-packages/sqlalchemy/orm/strategies.py:1475(load_scalar_from_joined_new_row)
111604 0.124 0.000 0.336 0.000 {method 'decode' of 'str'
objects}
as I can see creating objects and the query itself(?) takes a lot of
cpupower? But why? It is just a simple query? Is it really the object
creating? I just want to iterate over that data to display it in ordermenu
for the admin.
Or shall I use plain execution of sql for that, is sqlalchemy more for
specific queries to get specific data and not the mass data?
On Fri, Sep 12, 2014 at 6:40 PM, Jonathan Vanasco <[email protected]>
wrote:
> I think you need to profile the application like Mike said. Just to be
> thorough, I'd suggest you time the Query execution and the ORM population.
>
> Do you have an example of the faster raw SQL that you're trying to
> generate ?
>
> When you do a query on the commandline it is often faster because the
> database is only displaying the initial data on the screen. When you're
> using something like SqlAlchemy, the app needs to get all the data and then
> create objects. This is usually lightweight, but if you have some columns
> with a lot of data, there will be a hit. When you profile, you'll have a
> better idea if the query, the loader, of the connection is to blame.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.