robins / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
0 stars 0 forks source link

Is it possible evaluate to constant before going foreign? #1

Open robins opened 2 years ago

robins commented 2 years ago

Review whether there is room for optimization here. IOW - Is it possible evaluate to constant before going foreign?

tempdel=> explain (verbose) select * from t where a = random()::INTEGER;
                              QUERY PLAN
----------------------------------------------------------------------
 Foreign Scan on public.t  (cost=25.00..99719.00 rows=99694 width=36)
   Output: a, b
   Filter: (t.a = (random())::integer)
   Remote server startup cost: 25
   Remote query: SELECT `a`, `b` FROM `tempdel`.`t`
(5 rows)

Time: 1813.763 ms (00:01.814)
tempdel=> explain (verbose) select * from t where a = 234;
                               QUERY PLAN
------------------------------------------------------------------------
 Foreign Scan on public.t  (cost=25.00..27.00 rows=2 width=36)
   Output: a, b
   Remote server startup cost: 25
   Remote query: SELECT `a`, `b` FROM `tempdel`.`t` WHERE ((`a` = 234))
(4 rows)

Time: 698.709 ms
tempdel=>