• 请不要在回答技术问题时复制粘贴 AI 生成的内容
chaleaochexist
V2EX  ›  程序员

postgresql 单表数据量多大 开始考虑分区分表比较合理?

  •  
  •   chaleaochexist · Jun 4, 2019 · 11663 views
    This topic created in 2542 days ago, the information mentioned may be changed or developed.
    理论上 数据量 32T 之内.但是实际的生产环境呢?

    我记得之前在网上看到过 mysql 2000w 是一大关.

    pg 有没有类似的经验值?

    谢谢.
    10 replies    2019-06-10 10:18:35 +08:00
    chaleaochexist
        1
    chaleaochexist  
    OP
       Jun 4, 2019
    2000w 是 2000 万条记录.

    这里不需要考虑 一条记录有多少个字段.
    假设 10 个 charfield 字段.
    snappyone
        2
    snappyone  
       Jun 4, 2019
    要看你查询复杂度,没有一个恒定值的
    chaleaochexist
        3
    chaleaochexist  
    OP
       Jun 4, 2019
    另外,不考虑查询复杂度和时间 /效率要求.

    只是考虑,数据库在没有 DBA 帮助的情况下, 多大的记录数量,数据库会崩.
    Chenamy2017
        4
    Chenamy2017  
       Jun 4, 2019
    同求,有没有人有这方面经验。
    raptor
        5
    raptor  
       Jun 4, 2019
    崩是一般不会崩的,我家里一台 J1900/8G 内存的小破电脑(FreeBSD+PostgreSQL),跑一个单表将近 2 亿记录的库也没崩啊,只是查询速度比较感人而已。
    lolizeppelin
        6
    lolizeppelin  
       Jun 4, 2019
    @raptor
    哼哼 老实交代是不是什么 qq 关系库之类的 嘿嘿
    Ashitaka4
        7
    Ashitaka4  
       Jun 4, 2019 via iPhone
    现在 SSD 存储 2000w 就分表了?
    cuebyte
        8
    cuebyte  
       Jun 4, 2019
    看樓主的需求,猜測你需要 timescaledb 這個 pg 插件, 拿走不謝
    sagaxu
        9
    sagaxu  
       Jun 5, 2019 via Android
    分表之后如果还在同一台机器,且各个分区使用频率差不太多,那就毫无意义了
    raptor
        10
    raptor  
       Jun 10, 2019
    @lolizeppelin 嘿嘿,佛曰,不可说,不可说
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1439 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 17:03 · PVG 01:03 · LAX 10:03 · JFK 13:03
    ♥ Do have faith in what you're doing.