Closed jordiromera closed 3 years ago
Now with an Orale procedure, the following statement takes 300ms :
select oracle_execute('dflexnet', 'BEGIN CONS_IS_FXL2.SetTransferFlag_LOT(1, sysdate); END;')
And here is the code of procedure :
CREATE OR REPLACE PACKAGE BODY FLXPMR.CONS_IS_FXL2 AS
PROCEDURE SetTransferFlag_LOT(
iTransferFlag IN DTFXL2_LOT.TRANSFERFLAG%TYPE,
iTransferdate IN DTFXL2_LOT.TRANSFERLOCALDATE%TYPE
) AS
BEGIN
UPDATE DTFXL2_LOT
SET
TRANSFERFLAG = iTransferFlag,
TRANSFERLOCALDATE= iTransferdate;
END SetTransferFlag_LOT;
END CONS_IS_FXL2;
Note : Another field (TRANSFERLOCALDATE) is update in this procedure.
Yes, that is to be expected, because of the way that UPDATE
on foreign tables works in PostgreSQL:
UPDATE
statement is executed on the remote databaseIt is the number of round trips between PostgreSQL and Oracle (one per row updated) that will kill your performance. This is essentially the same problem as #260.
Bulk data modification is not efficient with oracle_fdw.
Welcome back !
OK, thank you for explanations. A workaround was found, and this issue should be closed.
Nevertheless, I am curious and, is it a limitation of oracle_fdw or any foreign data wrapper from PostgreSQL ?
That is a limitation of the FDW API in general.
In principle, you could work around it by actually running the UPDATE
instead of the Foreign Scan
and doing nothing for the ModifyTable
, but that is not trivial, and I am not motivated to do it.
I am facing on odd performance on simple update statement (without where condition).
Indeed, on a table with 3600 rows, the following statement takes 2 minutes :
With an Oracle IDE, this takes 80ms.
For details, here is the result of oracle_diag() :
oracle_fdw 2.4.0devel, PostgreSQL 11.12 (Debian 11.12-0+deb10u1), Oracle client 21.1.0.0.0
Oracle table :
PostgreSQL table :
And here is the EXPLAIN ANALYSE on this query :
This analysis point out a foreign scan, which seems odd to me, specially without where clause. Maybe there are round trip between the two databases on UPDATE statement ?
Also, I will test soon, this query encapsulates in Oracle procedure.
Thank you