9

PostgreSQL 分页查询 CPU 吃满的问题

 3 years ago
source link: https://www.v2ex.com/t/797877
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  PostgreSQL

PostgreSQL 分页查询 CPU 吃满的问题

  Uyuhz · 1 天前 · 1371 次点击

数据库服务器配置 20 核 32G,单机。100 并发持续时间 180 秒对某个简单分页查询接口进行压测。
期间应用服务器正常,数据库连接正常,但数据库服务器 CPU 占满,请问这是正常现象还是啥问题....

单表分页的首页查询,表内 1000 万数据,筛选出的数据为 28w,大概 sql 如下:

SELECT a,b,c,d,e FROM table WHERE del_flag = 0 AND c LIKE 'c%' order by e desc limit 10

SELECT COUNT(*) FROM table WHERE del_flag = 0 AND c LIKE 'c%'

使用 pg_stat_statements 查看


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK