Slide 8
Slide 8 text
© EDB 2024 - All Rights Reserved
8
FDW is Smarter and Faster
postgres=# explain (analyze, verbose) select * from dblink('host=pg1 user=postgres dbname=postgres', 'select
aid,bid,abalance,
fi
ller from pgbench_accounts') as t1 (aid int,bid int,abalance int,
fi
ller text) where aid = 1;
QUERY PLAN
----------------------------------------------------------------------------------------------
Function Scan on public.dblink t1 (cost=0.00..12.50 rows=5 width=44) (actual time=276.996..315.074 rows=1 loops=1)
Output: aid, bid, abalance,
fi
ller
Function Call: dblink('host=pg1 user=postgres dbname=postgres'::text, 'select aid,bid,abalance,
fi
ller from
pgbench_accounts'::text)
Filter: (t1.aid = 1)
Rows Removed by Filter: 99999
(...)
Time: 319.799 ms
postgres=# explain (analyze, verbose) select * from foreign_table where aid = 1;
QUERY PLAN
-----------------------------------------------------------------------------------------------------
Foreign Scan on public.foreign_table (cost=100.00..4629.02 rows=1 width=97) (actual time=1.220..1.222 rows=1 loops=1)
Output: aid, bid, abalance,
fi
ller
Remote SQL: SELECT aid, bid, abalance,
fi
ller FROM public.pgbench_accounts WHERE ((aid = 1))
(...)
Time: 4.259 ms