R
R
raiboon2015-01-20 15:38:57
PostgreSQL
raiboon, 2015-01-20 15:38:57

How to run queries from a function in parallel in Postgresql?

There are materialized views in postgres. There is a procedure:

FOR r IN SELECT matviewname FROM pg_matviews
    LOOP
        EXECUTE 'REFRESH MATERIALIZED VIEW ' || schema_arg || '.' || r.matviewname;
    END LOOP;

which takes the titles from pg_matviews and calls them with EXECUTE refresh. Is it possible to run these updates at once in parallel instead of one by one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yttrium, 2015-01-20
@yttrium

Your disk slows down, not the processor, how do you plan to parallelize the disk?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question