有没有一种系统的方法可以强制 PostgreSQL 将特定表加载到内存中,或者至少从磁盘中读取它以便系统缓存它?
表中的每一行都有一个系统列 ctid,其类型tid表示该行的物理位置:
Run Code Online (Sandbox Code Playgroud)create table t(id serial); insert into t default values; insert into t default values;
Run Code Online (Sandbox Code Playgroud)select ctid , id from t;ctid | ID :---- | -: (0,1) | 1 (0,2) | 2
dbfiddle在这里
从ctid最合适的类型(例如integer,bigint或numeric(1000,0))中获取页码的最佳方法是什么?
在我能想到的唯一的办法是非常难看。