Materialized view locking
554928Jul 29 2010 — edited Jul 30 2010I've got a process which uses DBMS_JOB (under Oracle 10.2.0.4) to start off two concurrent jobs. These jobs then run some queries and insert data into some tables. This has worked for us as a poor-man's version of parallelism to run two sides of a job at the same time.
This was working well until I decided to add a materialized view over the top of the tables and try to use fast refresh. Once I add the materialized view and a materialized view log, there are now locking issues and the two jobs do not process in parallel any longer.
I'm more of a data warehouse programmer so don't usually have to deal with locking at all so I'm a bit stumped about what to do. I haven't found any useful reference on the internet to tell me that a materialized view log will lock a table or anything else like that.
Unfortunately I can't provide a concise example because view involves about 8 tables but some simplified pseudo code would be:
Process A:
insert into master(pair_id, other_details) values (1,'PAIR_NAME');
spawn process B and C for sources 'SIDE-A' and SIDE-B'
Process B (spawned by A above):
insert into reconciliation (pair_id, side, type, result)
select 1, 'SIDE-A', type, result form side_a_query
Process C (spawned by A above):
insert into reconciliation (pair_id, side, type, result)
select 1, 'SIDE-B', type, result form side_b_query
There are a number of other tables in the hierarchy which aren't included in the example about but hopefully you get the idea. Of the 8 tables in the hierarchy, most of the transactions are inserts, with a couple of the tables being updated.
Basically want to use fast refresh because there is a summary table that is created and is currently taking about 15 minutes to create since each additional run of this job just inserts into the tables, fast refresh should be possible and should speed that up, but I've got the locking issues.
This was all working fine before the materialized view and materialized view log were added so hopefully it won't be too difficult to solve but I've now spent almost two days on this and can't really think what else to try.
Ideas, anyone?