pg pg_prewarm用法

按照插件

bash 复制代码
> create extension pg_prewarm ;

缓存表

bash 复制代码
> test=# select pg_prewarm('weather','buffer' ) ;  pg_prewarm
> ------------
>           1

缓存表部分内容

bash 复制代码
test=# select pg_prewarm('weather','buffer','main',0,0) ;
 pg_prewarm
------------
          1
(1 row)

表大小只有0号页,只能缓存这么大

缓存索引

bash 复制代码
test=# \d+ weather
                                                  Table "public.weather"
  Column   |         Type          | Collation | Nullable | Default | Storage  | Compression | Stats target | Description
-----------+-----------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 city      | character varying(80) |           |          |         | extended |             |              |
 temp_low  | integer               |           |          |         | plain    |             |              |
 temp_high | integer               |           |          |         | plain    |             |              |
 prcp      | real                  |           |          |         | plain    |             |              |
 date      | date                  |           |          |         | plain    |             |              |
Indexes:
    "idx_city" btree (city)
Access method: heap

test=# select pg_prewarm('idx_city','buffer' ) ;
 pg_prewarm
------------
          2

影响:

相关推荐
copyer_xyf14 小时前
Agentic RAG 实战:PostgreSQL + LangGraph 一条链路
python·postgresql·agent
jnrjian17 小时前
EDB PEM 安装加强 curl
postgresql
岳麓丹枫00118 小时前
PgBouncer 从原理到实践
postgresql
IvorySQL1 天前
PostgreSQL 日报 | JOIN 与外键优化(8 月 9 日)
数据库·postgresql
IvorySQL1 天前
PostgreSQL 日报| PostgreSQL 19 默认 WAL 压缩算法(8 月 8 日)
数据库·postgresql·区块链
切糕师学AI1 天前
从压缩到查询:PostgreSQL中JSON数据的存储与处理实践
数据库·postgresql·json
瀚高PG实验室2 天前
几种因网络波动导致应用与数据库操作异常的现象
运维·网络·数据库·postgresql·瀚高数据库
PGCCC3 天前
Ubuntu 安装 PostgreSQL 16 完整教程(2026):从仓库配置到远程连接
linux·ubuntu·postgresql
jnrjian4 天前
postgres database 更换用户
数据库·postgresql
李昊哲小课4 天前
Ubuntu24.04 PostgreSQL 18 完整安装与配置教程
ubuntu·postgresql