I have many foreign tables imported by IMPORT FOREIGN SCHEMA
:
CREATE USER MAPPING FOR myuser
SERVER postgres
OPTIONS ( user 'myuser', password 'mypass');
IMPORT FOREIGN SCHEMA public from server postgres INTO public;
I have many queries that join my local tables and foreign tables.
Q1: If I use pg_prewarm
and the put the whole table in memory, it helps me not every time to take this table by a network.
Q2: I am worried if data changes on the foreign PostgreSQL server will be visible on my local server if the foreign table is cached.
Example: core_category
is a foreign table
SELECT pg_prewarm(
'core_category',
-- "pre warm" pages of the last 1000 pages for 'mytable'
first_block := (
SELECT pg_relation_size('core_category') / current_setting('block_size')::int4 - 1000
)
);
-- or
SELECT * FROM pg_prewarm('core_category', 'buffer');