推荐学习书目
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 · 5120 views
    This topic created in 3593 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
        1
    tumb8r  
    OP
       Jul 17, 2016
    any body?
    linnchord
        2
    linnchord  
       Jul 17, 2016
    看上去是系统杀了这个进程,你可以同时运行下 top 看看内存占用。

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