SQL Performance (MOSC)

MOSC Banner

Tuning not in clause SQL

edited Jan 21, 2014 4:38AM in SQL Performance (MOSC) 7 commentsAnswered
Hi Gurus,

Have an expensive query that uses 'not in'.


SELECT applicant_id,
       Nvl(registration_site, 'UK')         AS registration_site,
       email,
       Decode(withhold_third_party_info, 'Y', 0,
                                         'N', 1,
                                         0) AS withhold_third_party_info
FROM   applicant
WHERE  registration_site NOT IN ( 'JP', 'JX', 'YJ', 'SP',
                                  'Q2', 'JL', 'KA', 'K2',
                                  'KK', 'KX', 'Q1' );

When I checked distinct registration_site, there are 105 so can't use 'in' to eliminate 'not in'.


Execution Plan
----------------------------------------------------------
Plan hash value: 2341318952

-------------------------------------------------------------------------------
| Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |           |    16M|   598M|   191K  (2)| 00:38:19 |
|*  1 |  TABLE ACCESS FULL| APPLICANT |    16M|   598M|   191K  (2)| 00:38:19 |
-------------------------------------------------------------------------------

Predicate Information (identified by operation id):

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