user93796
user93796

Reputation: 18389

merge query running very slow

I am using Oracle DB and trying to issue a merge query by using spring jdbc temple.

Sample oracle query is as follows

 MERGE INTO table_name  b
     USING (select 'id','fid','somedata' from DUAL a
     ON (a.id = b.id and a.fid = b.id)
    WHEN MATCHED THEN
     UPDATE SET col_name = 'some_val' where  lastUpdateTime > someTime
    WHEN NOT MATCHED THEN
     INSERT (id,fid col_name)
     VALUES ('id','fid', 'some_val')

This query was running propery before but its running very very slow now(In minutes)

The table details :
id,fid as composite primary key
partitioned on record creationDate.
No of records in table is around 15 million

Why is the query performane so slow?

Upvotes: 2

Views: 1229

Answers (1)

HAL 9000
HAL 9000

Reputation: 3985

When it's running for minutes you should find an explanation using

select * from v$session_longops where time_remaining > 0

Upvotes: 1

Related Questions