Hi all ,

We are observing very high memory and cpu consumption almost 100% CPU and 
memory for one of the API call  witch select query . 


In our model we have many tables like


TABLE A - Parent  ( recording session)


Table B - Child of A ( table a id as FK)  (video )


Table C - Child of B ( table C id as FK) ---> Very high Memory / CPU ( 
images)


In addition to above table we have many other related tables (parent - 
child ) also .


Table A is like recording session which contains many videos ( Table B) 
which contains many images ( Table C) . 


So for 30 min recording session we have 30 clips of videos and then 30 * 30 
= 900 images i.e image metadata and not actual image. 


We have created relationships between tables using db.relationship so that 
we can use filter operations as well.


Once we trigger the query to fetch say 900 images metadata and not actual 
images then  query is almost blocked with 100 % CPU and Memory. 

.

Please let me know how to debug this issue . We suspect issue in db 
relationships  / some  infinite loop in query . 


class Images(db.Model):
    __tablename__ = 'images'


videoclips = db.relationship('VideoClip', backref='images', lazy='joined')



class VideoClip(db.Model):
    __tablename__ = 'video_clip'


images = db.relationship('Images', backref='video_clip', lazy='joined')


Similarly there are many one to many relationships are defined. Is it related 
to lazy=joined which i 

have used  for filter operations. 


Please let me know if anyone has faced this kind of issues. 


Regards

Nitin




-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/0ba4d972-6a65-49a6-993f-1db65b7b8a33%40googlegroups.com.

Reply via email to