create extension pg_dropcache; create extension pg_buffercache; -- create table t(x int); insert into t select * from generate_series(1, 1000000); select page_count > 4000 as page_count_gt_4000 from ( select count(*) as page_count from pg_buffercache where relfilenode = pg_relation_filenode('t'::regclass) ) as foo; page_count_gt_4000 -------------------- t (1 row) select pg_drop_rel_cache('t'::regclass); pg_drop_rel_cache ------------------- (1 row) select count(*) from pg_buffercache where relfilenode = pg_relation_filenode('t'::regclass); count ------- 0 (1 row) -- create table t1(x int); create table t2(x int primary key); insert into t1 select * from generate_series(1, 1000000); insert into t2 select * from generate_series(1, 1000000); select page_count_t1 > 4000 as page_count_t1_gt_4000 from ( select count(*) as page_count_t1 from pg_buffercache where relfilenode = pg_relation_filenode('t1'::regclass) ) as foo; page_count_t1_gt_4000 ----------------------- t (1 row) select page_count_t2 > 4000 as page_count_t2_gt_4000 from ( select count(*) as page_count_t2 from pg_buffercache where relfilenode = pg_relation_filenode('t2'::regclass) ) as foo; page_count_t2_gt_4000 ----------------------- t (1 row) select page_count_t2_pkey > 40 as page_count_t2_pkey_gt_40 from ( select count(*) as page_count_t2_pkey from pg_buffercache where relfilenode = pg_relation_filenode('t2_pkey'::regclass) ) as foo; page_count_t2_pkey_gt_40 -------------------------- t (1 row) select pg_drop_cache(); pg_drop_cache --------------- (1 row) select count(*) from pg_buffercache where relfilenode = pg_relation_filenode('t1'::regclass); count ------- 0 (1 row) select count(*) from pg_buffercache where relfilenode = pg_relation_filenode('t2'::regclass); count ------- 0 (1 row) select count(*) from pg_buffercache where relfilenode = pg_relation_filenode('t2_pkey'::regclass); count ------- 0 (1 row)