Skip to Main Content

Improve query performance instead of aggregrate function

user12251389Aug 18 2017 — edited Aug 18 2017

I have query where i want to change the SALES_DATE to '01.01.2017' for the 1st record for a product. It means i want to get every unique product which is stored in PRODUCT_ID and check the first SALES_DATE on which the product is loaded and change this SALES_DATE to '01.01.2017'.

I have used the below query which is working but its hitting the performance it seems. So is there any other i can write the same logic and improves the performance?

UPDATE TEST_GROUP sd

set SALES_DATE = TO_DATE ('01.01.2017', 'dd.mm.yyyy')

where SALES_DATE =

( select min(SALES_DATE)

   from TEST_GROUP sd2

   where sd.PRODUCT_ID = sd2.PRODUCT_ID  

)

and sd.SALES_DATE <> TO_DATE ('01.01.2017', 'dd.mm.yyyy');

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Sep 15 2017
Added on Aug 18 2017
28 comments
992 views