PostreSQL崩溃试验全记录
16lz
2021-01-22
磨砺技术珠矶,践行数据之道,追求卓越价值
回到上一级页面:PostgreSQL基础知识与基本操作索引页 回到顶级页面:PostgreSQL索引页
[作者 高健@博客园 luckyjackgao@gmail.com]
由于客户提到,运行某些大运算量批处理时,PostgreSQL突发性使用大量资源的问题,
进行了如下的调查,发现确实发生了崩溃。PostgreSQL 需要资源控制方案啊。
现在正在考虑是否必须要用 os 级别的限制方案:
过程如下:
测试环境:
内存:大约1024MB
postgresql.conf 设定:
使用缺省值:checkpoint_segments =3 shard_buffers=32MB
这些是有意为之,就是想看看数据量大、shared_buffer小的状况:
建立表(一条记录大约1024字节):
postgres=# create table test01(id integer, val char(1024));
向表中插入大量数据(总共插入2400MB)
postgres=# insert into test01 values(generate_series(1,2457600),repeat( chr(int4(random()*26)+65),1024));
插入操作会花费一些时间,此时用ps 命令看PostgreSQL个进程对内存使用状况:‘
[root@server ~]# ps aux | grep post root 3180 0.0 0.0 105296 712 pts/1 S 16:31 0:00 su - postgres postgres 3181 0.0 0.0 70304 676 pts/1 S+ 16:31 0:00 -bash postgres 3219 0.0 0.2 113644 2864 pts/1 S 16:32 0:00 /usr/local/pgsql/bin/postgres -D /gao/data postgres 3221 0.4 3.0 113724 35252 ? Ss 16:32 0:01 postgres: writer process postgres 3222 0.2 0.1 113644 1616 ? Ds 16:32 0:00 postgres: wal writer process postgres 3223 0.0 0.0 114380 1148 ? Ss 16:32 0:00 postgres: autovacuum launcher process postgres 3224 0.0 0.0 73332 472 ? Ss 16:32 0:00 postgres: stats collector process root 3252 0.0 0.0 105296 712 pts/2 S 16:32 0:00 su - postgres postgres 3253 0.0 0.0 70304 676 pts/2 S 16:32 0:00 -bash postgres 3285 0.0 0.0 83488 740 pts/2 S+ 16:32 0:00 ./psql postgres 3286 14.8 80.2 2598332 924308 ? Ds 16:32 0:35 postgres: postgres postgres [local] INSERT root 3333 0.0 0.0 65424 812 pts/3 S+ 16:36 0:00 grep post
更多相关文章
- 在Linux环境下,将Solr部署到tomcat7中,导入Mysql数据库数据, 定时更
- Jmeter—8 连接microsoft sql server数据库取数据
- 仅在SQL Server数据库中显示包含3个单词的名称
- 线程往数据库里插数据时偶尔会报错
- unity连接数据库MySQL简单例子
- 通过SQL语句访问远程数据库
- [SQL Server] 数据库日志文件自动增长导致连接超时的分析
- JSP连接Mysql的数据库连接池配置相关
- 一步一步学MySQL----13 多表数据记录查询之内连接