sql - 将表moSTLy或部分加载到工作内存中以供查询

标签 sql postgresql caching memory

我有一个 PostgreSQL 只读副本,其唯一目的是执行一些聚合查询。目前,为了进行聚合,正在进行大量 I/O,即使有大量可用内存,而且由于实例仅用于此目的,我想知道是否可能:

简单地告诉 PostgreSQL 缓存表的大部分内容以加速聚合查询。这可能吗?

最佳答案

根据 Craig 的评论:

The pg_prewarm module provides a convenient way to load relation data into either the operating system buffer cache or the PostgreSQL buffer cache. http://www.postgresql.org/docs/9.4/static/pgprewarm.html

不要忘记 pg_prewarm 是一个扩展,所以你必须添加它:

create extension pg_prewarm;

.. a lot of I/O is going on in order to do the aggregates, even though there's a lot of memory available ..

您可能还想研究一些内存配置选项 ( http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY )

关于sql - 将表moSTLy或部分加载到工作内存中以供查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33601179/

相关文章:

postgresql - 如何使用变量作为 node-pg 中的表名?

postgresql - at 符号 (@) 与冒号 (:) for parameter assignment in postgres/npgsql

php - 如何在 LIMIT 子句中应用 bindValue 方法?

sql - 如何使用oracle将整个列更新到另一个表中?

postgresql - GitLab CI : How to setup postgres image using GitLab secure variables

php - 配置在 Symfony Cache 中使用哪个 Redis 适配器

android - 加密 Android 上的 WebView 缓存

Android:如何停止/清除我的 Android 小部件应用程序的缓存后台进程?

java - 数据排序的最佳方式

mysql - 查询不起作用