Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Performance tuning SQL using Union all or unPivot

user13034857Jul 19 2018 — edited Jul 26 2018

Hello All;

I have huge data like

Data is like this -->   Firstname || Lname ||Address1 || Address2 || Address3 (900 Fields)

I used Union all like below and creating view for below script

I have 40 Union all

Select Firstname,

           Lname

           Address1

from Table1

Union all

Select Firstname,

           Lname

           Address2

from Table1

Select Firstname,

           Lname

           Address3

from Table1

The sql is running for long time and total records in table1 is 4M

It is running for long time when I want to check count or used in other script while joining.

Is there any other way I can run this script faster. I used unpivot and even it is taking longer time.

Thank you

Message was edited by: user13034857

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2018
Added on Jul 19 2018
18 comments
2,443 views