sraoss / pgsql-ivm

IVM (Incremental View Maintenance) development for PostgreSQL
Other
127 stars 12 forks source link

Ivm temp table problem #76

Closed thoshiai closed 4 years ago

thoshiai commented 4 years ago

This patch rewrites temp tables to EpheralNamedRelation(ENR) with tuplestores.

If use temp table for delta calculation of matview, it happens limit of max_locks_per_transaction error. e.g.

create table b1 (id integer, x numeric(10,3));
create incremental materialized view mv1 
as select id, count(*),sum(x) from b1 group by id;

do $$ 
declare 
    i integer;
begin 
    for i in 1..10000 
    loop 
        insert into b1 values (1,1); 
    end loop; 
end;
$$
;
ERROR:  out of shared memory
HINT:  You might need to increase max_locks_per_transaction.
CONTEXT:  SQL statement "DROP TABLE pg_temp_3.pg_temp_66154"
SQL statement "insert into b1 values (1,1)"
PL/pgSQL function inline_code_block line 1 at SQL statement

Additionally, it has other problems in using temp tables internally.

this problem is reported by https://www.postgresql.org/message-id/1577564109604-0.post@n3.nabble.com

thoshiai commented 4 years ago

This pull request is related to issued #70. ( I forget to write it)

thoshiai commented 4 years ago

I fixed this patch based on nagata-san review.

yugo-n commented 4 years ago

Could you please resolve the conflicts? I think it is due to the RLS commit..

thoshiai commented 4 years ago

I resolved its coflict.

yugo-n commented 4 years ago

I resolved its coflict.

Thank!

yugo-n commented 4 years ago

Regression tests all pass. I'll merge this.