On Dec 18, 2011, at 1:11 PM, rivka wrote:

> Hi,
> 
> I have a database with 1.2M rows at this point (in the main table -
> and even more rows in the one to many associated tables). I am trying
> to load the main table joined with a column from one of the associated
> table:
> 
> query = db.session.query(Employee).\
>                        options(joinedload(Employee.boss)).\
> 
> filter(and_(Employee.id>=FIRST_PATENT,Employee.id<end)).\
>                        order_by(Employee.id)
> 
> I have a MacBook Air. So far it has taken over 12 hours and it is
> still not done.
> Any idea  how long such a process can take and how to accelerate it?

There is no way to say.   A single row here could itself be 200 bytes or 1M in 
size.   The speed of the network is not known.  There are dozens of factors 
which can affect such an operation.

The 12 hour run time here suggests the program is in an exponentially-sized 
loop of some kind, like a cartesian product.   It's likely just churning.

You can't naively just run your program all day and hope it finishes.  You need 
to look at the SQL being emitted, determine if that SQL is correct and 
appropriate, check how much data you actually want to load, etc.   


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to