Database Tuning (MOSC)

MOSC Banner

Optimize OR join with connect by sub query

edited Oct 29, 2009 3:12AM in Database Tuning (MOSC) 2 commentsAnswered
   Hi,

I have a table that stores a representation of a folder hierarchy and contains about 16 million rows.  An application performs queries on this table using connect by clauses.  In the main these run OK, but certain end user actions can lead to the application performing a query such as below:

select * from folders where id_object in (

select id_object from folders

connect by prior id_object = id_parent

start with id_object = 'f10') or name = 'Test Folder';

The query above takes a few hours to complete, and the explain plan output indicates a full table scan of the folders table.

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