Join Causing Performance issue, is there a way to write a query using Exists

Copper Contributor

Team,

 

The With Temp1 is executing in 10 secs and it fetches - 700 records.

 

The FT_BASE table should fetch only the SUBSCRIBER_ID's that are there in Temp1 Table.

 

I have highlighted the statement which is causing the performance, please let me know if there is any alternate way of writing the query in Using 'Exists' OR IN.

 

The Final results should show only 700 Subscriber ID's

 

Thanks!

Bindu

1 Reply
Bindu, your really need all those joins in the CTE?
You also don't need to use all those columns inside the CTE, you can comment everething different from PRIMARY_SSCR_ID in the CTE.
That TO_CHAR(PRI.SUBSCRIBER_ID) AS PRIMARY_SSCR_ID can also be causing problems to you, why do you need that, if the join is a self join in the end?