Giter Club home page Giter Club logo

Comments (3)

laurenz avatar laurenz commented on September 17, 2024 1

I cannot think of any way to improve oracle_fdw so that it handles that more efficiently.

But why do you need to create a CSV file? I would write a PL/pgSQL function that first queries the Oracle table for the list of IDs, and store that in a temporary table or an array. Then the function eliminates the IDs you don't want, and finally it constructs a dynamic SQL statement with the literal numbers in it.

Something like

CREATE FUNCTION xyz() RETURNS SETOF foreign_table_b
  LANGUAGE plpgsql AS
$$DECLARE
   ids bigint[];
BEGIN
   SELECT array_agg(a.id) INTO ids FROM foreign_table_a AS a
   WHERE /* condition */
   AND NOT EXISTS (SELECT FROM local_table AS l
                   WHERE l.id = a.id);

   RETURN QUERY EXECUTE
      format(
         'SELECT FROM foreign_table_b WHERE id = ANY (%s)', ids;
END;$$;

from oracle_fdw.

laurenz avatar laurenz commented on September 17, 2024 1

Can we close the issue?

from oracle_fdw.

gnudiff avatar gnudiff commented on September 17, 2024

Can we close the issue?

Sure. I'll see if I can work with the function, thanks a lot for considering the case and sketching the idea!

(as regards export to csv it is just that the whole queries are part of task flow app and I might need to rerun tasks from previous results).

from oracle_fdw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.