SQL Performance (MOSC)

MOSC Banner

Lousy performance on "IN" clause on system views

edited Oct 29, 2013 5:00AM in SQL Performance (MOSC) 9 commentsAnswered
Ran into a lousy performing SQL today on Oracle 11.2.0.3, Windows 2008 64-bit, and it really surprised me:

SET AUTOTRACE ON

SELECT
   COUNT(*),
   SUM(BYTES)
FROM
   DBA_EXTENTS
WHERE
   SEGMENT_NAME IN (
      SELECT
         INDEX_NAME
      FROM
         DBA_INDEXES
      WHERE
         TABLE_NAME = 'CUSTOMER');

Statistics
----------------------------------------------------------
       7884  recursive calls
       1157  db block gets
    1706525  consistent gets
       8407  physical reads
          0  redo size
        606  bytes sent via SQL*Net to client
        500  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

What's going on here that deserves such a lousy performance?

I tried doing a simple join instead on an IN clause, and it performs somewhat poorly too:

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