SQL Performance (MOSC)

MOSC Banner

Conditional execution one of two parts of union all query

edited Apr 13, 2018 12:46PM in SQL Performance (MOSC) 6 commentsAnswered ✓

I have have two complex, expensive queries that I have performed a union all to bring together for use in a report tool

I have a bind variable that, if set to one value, the union query should execute the first part of the union. If the bind variable is set to a second value, then the second part of the union query should be executed.

However, when I look at trace and/or explain plans for my query, there is a cost coming from BOTH parts of the union query.

Here is a simplified version of what I am trying to do :

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center