推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
tumb8r
V2EX  ›  Python

flask-sqlalchemy 查询数据量大的时候,会退出程序!何解?

  •  
  •   tumb8r · Jul 17, 2016 · 5559 views
    This topic created in 3761 days ago, the information mentioned may be changed or developed.


    如上图,数据量大概就 2w 多,其实这不算多吧?但是如果是用 flask-sqlalchemy 查询的时候会退出 python ,显示 killed !放到网站上就会出现“ 502 bad gateway ”的错误!
    想知道能不能解决这种问题。。
    9 replies  •  2016-07-22 08:47:44 +08:00
    tumb8r
    tumb8r
    OP
    Jul 17, 2016
    1
    any body?
    linnchord
    linnchord
    Jul 17, 2016
    2
    看上去是系统杀了这个进程,你可以同时运行下 top 看看内存占用。

    2W 条算不算多得看每条记录里存的啥,存个 text 或者 blob 在后面,那也小不了。
    just4test
    just4test
    Jul 17, 2016
    3
    内存爆了吧。
    billlee
    billlee
    Jul 17, 2016
    4
    看看系统日志里面有没有 oom killer 什么的
    casparchen
    casparchen
    Jul 17, 2016 via iPhone
    5
    @tumb8r 吓尿了
    v2gba
    v2gba
    Jul 17, 2016
    6
    关闭 debug 模式试试
    ChiChou
    ChiChou
    Jul 17, 2016
    7
    为何不分页
    SlipStupig
    SlipStupig
    Jul 18, 2016
    8
    看一下 ulimit -a 查看一下 stack 大小,如果超过了可能会被 kill 掉,内存不够也会被 kill 掉, 建议用 yield 去存数据
    yudahai109
    yudahai109
    Jul 22, 2016
    9
    看一下 model ,你怎么引用的,是不是有很多外键,外键引用方式是咋样的? lazying 参数怎么配置的?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1558 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 17:43 · PVG 01:43 · LAX 09:43 · JFK 12:43
    ♥ Do have faith in what you're doing.