Dynamic execution returning large result sets
От | Emrul |
---|---|
Тема | Dynamic execution returning large result sets |
Дата | |
Msg-id | 1478481174567-5929177.post@n3.nabble.com обсуждение исходный текст |
Ответы |
Re: Dynamic execution returning large result sets
|
Список | pgsql-general |
Hi, I have a function that returns an SQL string as follows: CREATE OR REPLACE FUNCTION t1() RETURNS text AS $$ BEGIN RETURN 'SELECT * FROM mytable'; END $$ LANGUAGE plpgsql; and I want to create a second function (t2) that will execute the string returned by t1() and return the results. I thought about using RETURN QUERY EXECUTE as documented here: https://www.postgresql.org/docs/9.6/static/plpgsql-control-structures.html but there's a note towards the end that says '/if a PL/pgSQL function produces a very large result set, performance might be poor: data will be written to disk to avoid memory exhaustion, but the function itself will not return until the entire result set has been generated./' Is there any other way I can achieve execution of the dynamic SQL from t1() without having the whole result set retrieved inside the function itself? note: My example above is simplified, my real t1() function takes some parameters and generates SQL depending upon those parameters. Thanks! -- View this message in context: http://postgresql.nabble.com/Dynamic-execution-returning-large-result-sets-tp5929177.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
В списке pgsql-general по дате отправления: