Slow connect by ... start with subquery in 9i

Has anyone come across a performance problem (compared to 8i) when using hierarchical queries where the START WITH list is generated by a subquery? The culprit seems to be an extra visit to the subquery block as part of the CONNECT BY WITH FILTERING operation.
For example, take a simple tree structure:
CREATE TABLE tree
id NUMBER,
parentid NUMBER
CONSTRAINT tree_pk PRIMARY KEY (id)
...and a subquery - here just a table called sample with a subset of the ids from the tree table:
CREATE TABLE sample
id NUMBER,
CONSTRAINT sample_pk PRIMARY KEY (id)
...with which to drive the start points of the treewalk:
SELECT parentid, id, label
FROM tree
CONNECT BY PRIOR parentid = id
START WITH id IN
SELECT id FROM SAMPLE
With the tables populated and analyzed, I get this from 8i:
Execution Plan
.0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
.1....0...CONNECT BY
.2....1.....NESTED LOOPS (Cost=1 Card=1280 Bytes=10240)
.3....2.......INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=1 Card=1280 Bytes=5120)
.4....2.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
.5....1.....TABLE ACCESS (BY USER ROWID) OF 'TREE'
.6....1.....TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
.7....6.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=1)
Statistics
.....0..recursive calls
.....4..db block gets
.15687..consistent gets
....59..physical reads
.....0..redo size
223313..bytes sent via SQL*Net to client
.38276..bytes received via SQL*Net from client
...343..SQL*Net roundtrips to/from client
.....3..sorts (memory)
.....0..sorts (disk)
..5120..rows processed
and this is 9i:
Execution Plan
.0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
.1....0...CONNECT BY (WITH FILTERING)
.2....1.....NESTED LOOPS
.3....2.......NESTED LOOPS (Cost=2 Card=1280 Bytes=10240)
.4....3.........INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=2 Card=1280 Bytes=5120)
.5....3.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
.6....2.......TABLE ACCESS (BY USER ROWID) OF 'TREE'
.7....1.....NESTED LOOPS
.8....7.......BUFFER (SORT)
.9....8.........CONNECT BY PUMP
10....7.......TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
11...10.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=20480)
12....1.....INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (UNIQUE) (Cost=1 Card=1 Bytes=4)
Statistics
.....1..recursive calls
.....1..db block gets
.20525..consistent gets
....72..physical reads
...120..redo size
224681..bytes sent via SQL*Net to client
.38281..bytes received via SQL*Net from client
...343..SQL*Net roundtrips to/from client
.....9..sorts (memory)
.....0..sorts (disk)
..5120..rows processed
..so, about another 5000 logical reads, corresponding to the extra access of the sample table at the bottom of the query plan. So instead of just visiting the START WITH subquery once, to kick off the treewalk, I seem to be revisiting it for every row returned. Not too bad if that happens to be a unique index scan as here but that's not always the case.
I know I've got new options for re-writing this as a join under 9i, I'm just curious about those extra lookups and why they're necessary.
Cheers - Andrew

Hi Andrew,
Just noticed you message. I have exact same performance problem. It's just killing ant other processes and runs forever.
Could you please share you experience how to deal with "CONNECT BY" in 9i and also could you please tell about this option to re-write CONNECT BY as a join?
Thank you very much,
Victor

Similar Messages

  • Slow connect by prior ... start with subquery in 9i

    Has anyone come across a performance problem (compared to 8i) when using hierarchical queries where the START WITH list is generated by a subquery? The culprit seems to be an extra visit to the subquery block as part of the CONNECT BY WITH FILTERING operation.
    For example, take a simple tree structure:
    CREATE TABLE tree
    id NUMBER,
    parentid NUMBER
    CONSTRAINT tree_pk PRIMARY KEY (id)
    ...and a subquery - here just a table called sample with a subset of the ids from the tree table:
    CREATE TABLE sample
    id NUMBER,
    CONSTRAINT sample_pk PRIMARY KEY (id)
    ...with which to drive the start points of the treewalk:
    SELECT parentid, id, label
    FROM tree
    CONNECT BY PRIOR parentid = id
    START WITH id IN
    SELECT id FROM SAMPLE
    With the tables populated and analyzed, I get this from 8i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY
    .2....1.....NESTED LOOPS (Cost=1 Card=1280 Bytes=10240)
    .3....2.......INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=1 Card=1280 Bytes=5120)
    .4....2.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .5....1.....TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .6....1.....TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    .7....6.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=1)
    Statistics
    .....0..recursive calls
    .....4..db block gets
    .15687..consistent gets
    ....59..physical reads
    .....0..redo size
    223313..bytes sent via SQL*Net to client
    .38276..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....3..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    and this is 9i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY (WITH FILTERING)
    .2....1.....NESTED LOOPS
    .3....2.......NESTED LOOPS (Cost=2 Card=1280 Bytes=10240)
    .4....3.........INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=2 Card=1280 Bytes=5120)
    .5....3.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .6....2.......TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .7....1.....NESTED LOOPS
    .8....7.......BUFFER (SORT)
    .9....8.........CONNECT BY PUMP
    10....7.......TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    11...10.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=20480)
    12....1.....INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (UNIQUE) (Cost=1 Card=1 Bytes=4)
    Statistics
    .....1..recursive calls
    .....1..db block gets
    .20525..consistent gets
    ....72..physical reads
    ...120..redo size
    224681..bytes sent via SQL*Net to client
    .38281..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....9..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    ..so, about another 5000 logical reads, corresponding to the extra access of the sample table at the bottom of the query plan. So instead of just visiting the START WITH subquery once, to kick off the treewalk, I seem to be revisiting it for every row returned. Not too bad if that happens to be a unique index scan as here but that's not always the case.
    I know I've got new options for re-writing this as a join under 9i, I'm just curious about those extra lookups and why they're necessary.
    Cheers - Andrew

    There is undocumented parameter in Oracle 9i "_old_connect_by_enabled"
    which controls the behavoiur of hierarchy queries in 9i and above:
    You can try to return to 8i behaviour using it:
    SQL> SELECT parentid, id
      2  FROM tree
      3  CONNECT BY PRIOR parentid = id
      4  START WITH id IN
      5  (
      6  SELECT id FROM SAMPLE
      7  )
      8  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=26)
       1    0   CONNECT BY (WITH FILTERING)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE)
       3    2       NESTED LOOPS (Cost=2 Card=1 Bytes=26)
       4    3         TABLE ACCESS (FULL) OF 'SAMPLE' (TABLE) (Cost=2 Card
              =1 Bytes=13)
       5    3         INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (C
              ost=0 Card=1 Bytes=13)
       6    1     NESTED LOOPS
       7    6       BUFFER (SORT)
       8    7         CONNECT BY PUMP
       9    6       TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE) (Cost=
              1 Card=1 Bytes=26)
      10    9         INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (C
              ost=1 Card=1)
      11    1     TABLE ACCESS (FULL) OF 'TREE' (TABLE) (Cost=1 Card=1 Byt
              es=26)
      12    1     INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (INDEX (UNIQUE)) (Cos
              t=1 Card=1 Bytes=13)
    SQL> alter session set "_old_connect_by_enabled" = TRUE;
    Session altered.
    SQL> SELECT parentid, id
      2  FROM tree
      3  CONNECT BY PRIOR parentid = id
      4  START WITH id IN
      5  (
      6  SELECT id FROM SAMPLE
      7  )
      8  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=26)
       1    0   CONNECT BY
       2    1     NESTED LOOPS (Cost=2 Card=1 Bytes=26)
       3    2       TABLE ACCESS (FULL) OF 'SAMPLE' (TABLE) (Cost=2 Card=1
               Bytes=13)
       4    2       INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (Cos
              t=0 Card=1 Bytes=13)
       5    1     TABLE ACCESS (BY USER ROWID) OF 'TREE' (TABLE)
       6    1     TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE) (Cost=1
              Card=1 Bytes=26)
       7    6       INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (Cos
              t=1 Card=1)
    Rgds.

  • Recursive Hierarchical Query with CONNECT BY/START WITH

    I want to traverse a tree which has is not hierarchical in linear sense. You know, like :
    A
    B
    C
    D
    E
    C
    F
    D
    E
    C
    You see that D, Eand C are repeated and C is under E as well as under B. I tried using CONNECT BY and START WITH but I get tripliate occurances of C under B, and 2 occurances of DEC under A and under F. Clearly this is not correct. I believe SQL3 has special way of handling with such recursive trees. How does O9i handle these constructs? Please help.

    CREATE OR REPLACE PACKAGE hierarchy
    IS
      TYPE branchtable_type IS TABLE OF VARCHAR2 (4000)
      INDEX BY BINARY_INTEGER;
      branchtable branchtable_type;
      FUNCTION branch
        (v_level     IN NUMBER,
         v_value     IN VARCHAR2,
         v_delimeter IN VARCHAR2 DEFAULT CHR (0))
        RETURN VARCHAR2;
      PRAGMA RESTRICT_REFERENCES (branch, WNDS);
    END hierarchy;
    CREATE OR REPLACE PACKAGE BODY hierarchy
    IS
      returnvalue VARCHAR2 (4000);
      FUNCTION branch
        (v_level     IN NUMBER,
         v_value     IN VARCHAR2,
         v_delimeter IN VARCHAR2 DEFAULT CHR (0))
        RETURN VARCHAR2
      IS
      BEGIN
        branchtable (v_level) := v_value;
        returnvalue := v_value;
        FOR i IN REVERSE 1 .. v_level - 1
        LOOP
          returnvalue := branchtable (i)
          || v_delimeter
          || returnvalue;
        END LOOP;
        RETURN returnvalue;
      END branch;
    END hierarchy;
    SELECT   id, parent_id, print_order, lvl
    FROM     (SELECT     id, parent_id, print_order, LEVEL lvl,
                         hierarchy.branch (LEVEL, print_order) branch
              FROM       test_table
              START WITH parent_id IS NULL
              CONNECT BY PRIOR id = parent_id)
    ORDER BY branch
            ID  PARENT_ID PRINT_ORDER        LVL
             1                      1          1
             6          1           1          2
             5          1           2          2
             2          1           3          2
             4          2           1          3
             3          2           2          3
    6 rows selected.

  • Slow connection at start then fine

    I almost think this is a DNS setting issue, but not sure.
    When I first start my computer and open a web application, (safari, firefox, iChat), they time out waiting for a response from the internet.
    After about 5-8 minutes of waiting and refreshing it will suddenly start working. Once it works for the first time, it will continue to work until I power down.
    This scenario holds true for both my iMac's running Tiger 10.5ish and my new Mac Pro running Leopard. There is no problem with my Windows machines or Linux boxes.
    I use a BellSouth (now AT&T) high speed DSL connection plugged in to a DSL Modem, which plugs in to a linksys router, and then to my computer. Add an airport after the linksys router to see my setup for one of my iMacs.
    Any idea's at all? I saw some stuff on setting up a PPoE connection, but I'm running through a router that does that for me, so I don't think that would make sense here.
    This has been plaguing me for nearly a year, finally after receiving my new mac with Leopard I thought I would ask.
    It is not safari only, and may be nothing you can help with, but a point in the right direction would be great.

    Any thoughts?

  • Loosing and slow connection with Airport Extreme

    Hi. Before I start, I hope there are some who suffer the same problem as me.
    First of all, I have a problem with my MacBook and Airport Extreme. The Network I created with Airport is getting really slow or unconnected with my MacBook. So I tried to reset both the modem and Airport. Actually, it kinda works, however this problem occurs later.
    First time I thought it was the problem with uTorrent that I didn't use uTorrent anymore but it still has a problem.
    Because of this **** problem, I have to reset my modem and Airport Extreme several times a day and it really stressed me out. Embarrasingly, I don't even know what the problem is. is ti the problem with My macBook? AirPort Extreme? Modem? No idea..
    I need a help...
    P.S. Modem seems working fine since the ethernet is working fine. maybe problem of Airport or MacBook. I think I should go to the Genius Bar but I am afraid that 'Genius' is going to just check once and say 'It has no problem.'

    zdawg77 wrote:
    I too am having very slow connection speed issues with two of my white macbooks, both running 10.6.2, same airport extreme wireless adapter (built in). The strange thing is, these two macbooks came in a macbook 5-pack, and the 3 other laptops all have excellent speed. Nothing different has been done with these 2 laptops - all were updated (albeit the 2 were much slower to download the update), with nothing new installed otherwise...
    There were some Macbooks that had an issue with the screws holding their internal AirPort cards in place loosening, resulting in noise and lower signal levels from the antennas.
    You may want to try taking one of the affected Macbooks to a local Apple Store and see if you experience the same issues on their in-store network.

  • Join two Connect By Prior Start With trees and return only common records?

    Oracle 10g Release 2 (10.2)
    I have two tables that have tree structured data. The results, when running the queries individually are correct, however I need to join tree one to tree two in order to obtain only the common records between them.
    -- Tree one
    SELECT ip_entity_name, entity_code, hier_level, entity_parent
    FROM ip_hierarchy
    WHERE hier_level >= 3
    CONNECT BY PRIOR entity_code = entity_parent
    START WITH entity_code = 'MEWWD';
    -- Tree two
    SELECT ip_entity_name, entity_code, hier_level, entity_parent
    FROM ipt_hierarchy
    WHERE hier_level >= 3
    CONNECT BY PRIOR entity_code = entity_parent
    START WITH entity_code = 'IPNAM';
    As I understand, joins may not work with CONNECT BY/START WITH queries?
    Is a WITH clause an option?
    If at all possible, I don't want to put one select in a View database object and join against the other query.
    Thanks.

    Hi JTP51,
    You can use WITH clause or sub-query by using in-line view, without creating any view object in database.
    for example
    SELECT A.IP_ENTITY_NAME, A.ENTITY_CODE, ....
      FROM (SELECT IP_ENTITY_NAME, ENTITY_CODE, HIER_LEVEL, ENTITY_PARENT
              FROM IP_HIERARCHY
             WHERE HIER_LEVEL >= 3
            CONNECT BY PRIOR ENTITY_CODE = ENTITY_PARENT
             START WITH ENTITY_CODE = 'MEWWD') A,
           (SELECT IP_ENTITY_NAME, ENTITY_CODE, HIER_LEVEL, ENTITY_PARENT
              FROM IPT_HIERARCHY
             WHERE HIER_LEVEL >= 3
            CONNECT BY PRIOR ENTITY_CODE = ENTITY_PARENT
             START WITH ENTITY_CODE = 'IPNAM') B
    WHERE A. ENTITY_CODE = B. ENTITY_CODE
    AND ....Best regards,
    Zhxiang
    Edited by: zhxiangxie on Feb 2, 2010 5:35 PM

  • Outlook 2013 slow to start with Outlook 365 on Windows 7

    Hi,
    I get to work, start up my PC. It's windows 7.
    The first thing I do is kick off Outlook 2013 which piggy backs off office 365.
    It takes a minute for the splash screen to appear, another minute of watch dots fly across the splash page then a minute while add-ins get applied.
    Why does it take so long for the first two phases to complete?
    What add ins do I actually need? I've disabled those I think surplus to requirements, but in reality if Outlook 2013/0ffice 365 need them why do they need to be added in at all?
    Thanks.
    K
    Note: this post was originally at
    http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/outlook-2013-slow-to-start-with-outlook-365/45b18f1c-5c70-4d69-aea7-4562efbe147f?rtAction=1392808530575
    but I have since been advised to post it here to.

    Hi,
    According to your description, outlook 2013 connects to Exchange online server very slowly.
    If yes, we can try the following methods to narrow down the cause of the slow performance:
    1. Try start your Outlook in  safe mode, and check the launch speed;
    2. Check if you have enabled  Cache Exchange Mode, if no, enable it and try start Outlook, and check the launch speed;
    3. Create a new profile with no email account, try start Outlook, and check the launch speed;
    4. Create a new Profile with the other email account, try start Outlook, and check the launch speed;
    Since the issue is related to Exchange online, I recommend you ask for help on our Exchange online forum:
    http://social.technet.microsoft.com/Forums/msonline/en-US/home?forum=onlineservicesexchange
    Thanks for your understanding in advance.
    If you have any question, please feel free to let me know.
    Thanks,
    Angela Shi
    TechNet Community Support

  • Slow connection after 2nd latest upgrade with AUR 8192cu-dkms package

    I have a wireless network connection with a "EDUP Ultra-Mini Nano USB 2.0 802.11n 150Mbps Wifi/WLAN Wireless Network Adapter", witch has the rtl8192cu chippset.
    From the start I have hade problems with lag, droped packages and slow connection with the original rtl8192cu package. So after a while I installed the 8192cu-dkms package from AUR and it worked prefectly. Before I would just reach speed at between 5 to 60 KB/sec, but after I installed the package I would reach the maximum of ca 800 KB/sec.
    After the next to last kernel upgrade (I think it was linux 3.17.3-1-ARCH or 3.16.???-ARCH) the speed droped back down to 15 to 100 KB/sec and it stared to lag. (And yes, I reinstalled 8192cu-dkms everytime I upgraded the kernel.) And the original drivers are still loosing more packages and have slower speed then 8192cu-dkms.
    I have other computers on the same network and they allways reach ca 800 KB/sec and I have tried diffirent router settings and I am certain that the problem is with my drivers.
    I use wifi-menu to connect to my network, since wpa_supplicant apperantly dosen't work with 8192cu-dkms.
    I have tried reinstalling them with no improved results. And I am out of ideas.
    Any one have the same problem or a solution?
    Is it a good or bad idea to downgrade to the last kernel version were it worked?

    This is basically my experience with every Realtek wireless chipset I have ever used on Linux.  Honeslty, if you have the means, get something else.  Realtek does a pretty shitty job writing and maintaining their Linux drivers.
    Edit: See this thread for another user's awesome experience of a recent Realtek wireless chipset.
    When I was struggling with a rtl8192ce a while back, I remember that there were a few module options that made it run slightly better.  This was basically just to set it to use software encryption, and turn off any and all low power states.
    Last edited by WonderWoofy (2014-12-13 23:58:09)

  • Hierarchical connect by and start with and joins?

    I've got an employees table and an identifiers table. The identifiers table is hierarchical, with parents and children. Each employee has one or more identifiers, but only one identifier is considered the "primary" or root identifier for each employee. Unfortunately, the employee table might be pointing at one of the child identifier rows and not the root. I need a fast query to join the employees with their most current (root) identifier.
    Here's code to define the problem.
    create table employees (employeeid varchar2(8), fakeNationalID varchar2(9), empname varchar2(30));
    insert into employees (employeeid, fakeNationalID, empname) values (1,'001000001','John Smith');
    insert into employees (employeeid, fakeNationalID, empname) values (2,'002000002','James Jones');
    create table realids (realidkey NUMBER, fakeNationalID VARCHAR2(9) not null,
       realNationalID VARCHAR2(9) UNIQUE, parent_realidkey number);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (1,'001000001','111111111',3);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (2,'002000002','222222222',null);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (3,'003000003','333333333',null);
    commit;  
    create or replace function get_parentid (fakeID in VARCHAR2) return varchar2 is
       tempid VARCHAR2(9);
       begin
          select realNationalID into tempid
             from (
               select realNationalID, fakeNationalID
                  from realids
                  start with fakeNationalID = fakeID
                  connect by nocycle prior parent_realidkey = realidkey
                  order by level desc)
                  where rownum = 1;
          return tempid;
          exception
             when NO_DATA_FOUND then
                return NULL;
             when others then raise;
        end;
    select get_parentid('001000001') from dual; -- returns 333333333 because its linked to a parent
    select get_parentid('002000002') from dual; -- returns 222222222 because there is only one child
    select get_parentid('003000003') from dual; -- returns 333333333 because it is the parentWhat I want is to get the highest parent node in realids for each row in employees...
    This works, but is NOT very efficient:
    select employeeid, get_parentid(fakeNationalID) realid, empname from employees;
    employeeid   realid       empname
    1            333333333     John Smith
    2            222222222     James JonesYou can imagine what this would be like with 100K rows or greater. It takes about 3 minutes to run.
    This seemed like a good way to do this, but with a sub query.
    select e.employeeid, e.fakenationalid, e.empname, sub.realnationalid
       from employees,
          (select realidkey, fakenationalid, realnationalid, parent_realidkey
             from realids r
             start with r.fakenationalid = e.fakenationalid
             connect by prior r.parent_realidkey = r.realidkey) subUnfortunately, it produces an invalid identifier on e.fakenationalid (in the start with clause).
    Anyone have any ideas on how to get the top most parent node from the realids for each row in the employees table? In real life there are 6 or more employees tables spread across several remote instances some of which point at children in the realids table and some of which point at the parents. We always want the top most parent realid. Any help would be much appreciated.

    Hi,
    Thanks for posting the sample data in such a convenient form!
    It always helps to post your Oracle version, too, especially when dealing with CONNECT BY queries.
    The following does what you requested in Oracle 10:
    WITH     got_roots   AS
         SELECT     CONNECT_BY_ROOT     fakenationalid     AS leaf_id
         ,     realnationalid
         FROM     realids
         WHERE     CONNECT_BY_ISLEAF     = 1
         START WITH      fakenationalid IN ( SELECT  fakenationalid
                                              FROM    employees
         CONNECT BY     realidKEY     = PRIOR parent_realidkey
    SELECT     e.employeeid
    ,     r.realnationalid
    ,     e.empname
    FROM     employees     e
    JOIN     got_roots     r     ON     r.leaf_id     = e.fakenationalid
    ;In any query, calling a user-defined function for each row is going to be slow. Fortunately, Oracle now has built-in functions and operators that can take the place of get_parentid. The CONNECT_BY_ROOT operator, which was introduced in Oracle 10, is the key to this problem. In Oracle 9, you can get the same results using SYS_CONNECT_BY_PATH.
    It's usually faster to do the CONNECT BY query separately, and then join whatever other tables you need to the results.
    You had a good idea in your last query. The problem was that sub and employees were equal tables in the FROM clause, and you can't correlate equals. You can only correlate a sub-query to its super-query. You could make that general idea work by changing sub into a scalar sub-query,which could be correlated to employees, but I think it would be a lot less efficient than what I posted above.

  • Rent Movies, Even With Slow Connection?

    With the new Apple TV, is it possible to rent Movies even if you have a really slow (e.g 0.5Mbps) internet connection?
    If you start a rental in the morning, and leave it downloading all day, will the Apple TV automatically use its 8GB of cache to store the file so that it will play continuously from start to finish, without needing to stream?

    Reuben Feffer wrote:
    With the new Apple TV, is it possible to rent Movies even if you have a really slow (e.g 0.5Mbps) internet connection?
    If you start a rental in the morning, and leave it downloading all day, will the Apple TV automatically use its 8GB of cache to store the file so that it will play continuously from start to finish, without needing to stream?
    Funnily enough I've not rented anything on it yet, but I firmly believe it will load the whole movie into the solid state buffer. If it did not do this people would be very frustrated if they decided to go back a couple of chapters after the phone rang for instance and they forgot to pause.
    Until I try a rental I can't say for certain, but it would seem quite illogical (which is no guarantee) not to store the whole rental on the unit to allow for predownloading on slower connections but also for replay and chapter selection/skips/ff/rw purposes during the rental playback period.
    The big unanswered question for me (maybe someone else has figured out by now) is how the 8GB of solid state memory is dished out and what purges existing content in the solid state memory.
    For example - a single HD rental should fit in that 8GB, possibly two. However say the user has 2GB of photos streaming, do they have priority for memory usage ovr rentals or vice versa? The iPad has a 16GB limit for photos (or did in older OS), even on a 32GB/64GB machine, so maybe only 1-2MB is reserved for photo caching on ATV2, maybe the whole 8Gb is available, who knows?
    Certainly local media from iTunes seems to cache to the unit, and quicker than ATV1, so the danger if the memory management is illogical is that any activity you do while caching an HD rental could potentially flush the cached rental in order to play the local media, but this would be daft and I hope they would reserve enough solid state memory for the rental and force the local media to cache in a smaller segment even if it meant repeatd cacheing to watch the whole thing (done transparently to the user).
    What if you rent two HD movies?
    Does the first download to the cache then the 2nd?
    Do they download concurrently?
    If they're too big for 2 in the cache does 1 of them flush the other rental out to maker room?
    IMO this is all a bit vague and unpredictable.
    Message was edited by: Alley_Cat

  • TS3274 its almost 10 months,i purchased ipad2 32 3g wifi.itinially i got problem with applications shut off frequently now since last 4 months my ipad starts with a message (connect iTunes)like first time start and going to restore mode and it occurs freq

    its almost 10 months,i purchased ipad2 32 3G wifi.itinially i got problem with applications and safari shut off frequently now since last 4 months my ipad starts with a message (connect iTunes)like first time start and going to restore mode and it occurs frequently.plz advise.

    If you have followed the standard Apple troubleshooting processes (see user guide )
    probably a trip to the local Apple Store Genius bar is called for before warranty runs out
    Assuming the iPad has been released in your Country if not you may have to take it to a
    neighbouring Country where it is available
    This page will tell you ,via the drop down menu Countries that can support iPad
    http://support.apple.com/kb/index?page=servicefaq&geo=United_Kingdom&product=ipa d

  • HT201250 i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. do i keep my files in the portable hard disk when I connect it again with the macbook or the time machine will era

    i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. Am i keeping my files in the portable hard disk when I will connect it again with the macbook or the time machine will erase all?
    I would like to know if after I erase all my data, empy hard drive inside the macbook, the time machine will erase all my files that I have saved in my "WD "My passport" external hard drive

    Welcome to Apple Support Communities
    Time Machine has to erase the external disk in order to make backups. Before setting Time Machine up, copy the files of your external disk to the hard disk of the Mac in order not to lose them, and then, set up Time Machine. The first backup will start automatically.
    If you want more information about Time Machine, read the Pondini's site > http://pondini.org

  • Mavericks install incomplete. No Apple installers on HD. Will I be able to upgrade to Yosemite and will it fix all that didn't install with Mavericks upgrade? Very slow connection speeds 30 hrs to download Mavericks. Tried re-install; no help/

    Ever since upgrade to Mavericks I have been having problems which are too numerous to mention. I finally found a program from a UCBerkley professor called Pacifier which indicated 4000+ of 400,000+ files and folders did not install. I was unable to go further to try to fix everything because Pacifier can't find ANY Apple installers on my HD. It recommended I download the Mavericks installer without reinstalling to continue; however, after having done so (very slow connection; takes 30 hours to download) and although the installer appears in apps while downloading it disappears and NO Apple installer packages can be found on my hard drive. I tried to download Yosemite once and it indicated my system wasn't eligible for the upgrade. Its' download time was similar to Mavericks; 28+ hours.
    I am using a Macbook Pro mid-2012 version OS X 10.9.5 (13F34); Processor 2.5 GHz Intel Core i5; Memory  4 GB 1600 MHz DDR3; Graphics  Intel HD Graphics 4000 1024 MB.
    Regardless of how many files and apps I remove my memory is being eaten up to the point I can hardly do anything at all. There are no civil words for how frustrated I am. Someone please help me.
    Thanks,
    JJ

    Install Mavericks, Lion/Mountain Lion Using Internet Recovery
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Internet Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND-OPTION- R keys until a globe appears on the screen. Wait patiently - 15-20 minutes - until the Recovery main menu appears.
    Partition and Format the hard drive:
    Select Disk Utility from the main menu and click on the Continue button.
    After DU loads select your newly installed hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed. Quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion. Mavericks: Select Reinstall Lion/Mountain Lion, Mavericks and click on the Install button. Be sure to select the correct drive to use if you have more than one.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
    This should restore the version of OS X originally pre-installed on the computer.

  • When i connect my Ipad with My pc Itune is giving msg that " This IPad Cannot  use because Apple Mobile Devise is not started"

    when i connect my Ipad with My pc Itune is giving msg that " This IPad Cannot  use because Apple Mobile Devise is not started"

    You might want to take a look at this kb
    http://support.apple.com/kb/TS1538

  • Using in the Start With portion of a Connect By query

    I'm trying to use a <> in the Start With portion of a hierarchical query (uses Connect By) and the performance is truly pathetic.
    Does anyone know the reason why this would perform so poorly?
    And does anyone have a solution for a work-around or better way of doing this?

    A 'not equals' condition like that usually means either a full-table scan or an index full-scan - neither of which are screamers.
    Would you provide some details about the table and the exact query?

Maybe you are looking for

  • Macbook Leopard Update- Hard drive not recognized?!?!

    Question- What do you think caused this problem, and how can I best fix it? (See below for information) Well, I finally decided to update to Leopard. I put the disk in my Macbook, and everything went smoothly as it verified the installation DVD- unti

  • 16:9 Help needed. Workflow: extracted video from DVD, FCE HD edit & DVDSP.

    Hi, I have a project where according to the camera person it was shot in 16:9 with the camera (assuming a DV camcorder of some sort). It was captured from the camera and converted to a DVD (VIDEO_TS folder and everything) and sent to me for editing.

  • Kodo 3.4.1 and Oracle JDBC 11.1.0.6?

    Hi, did anybody already try using Kodo 3.4.1 and Oracle JDBC driver 11.1.0.6? We have been able to use it by specifying: kodo.jdbc.DBDictionary=oracle(BatchLimit=1000) but it does not run very smoothly and we get for example the following exception (

  • Wiki/Blog Widgets

    I am looking for templates and widgets that work with OS X  Server Wiki and Blog pages. I figured out how to embed youtube videos into the pages but I need to upload pictures but the pictures show up full size and not small and with the ability to cl

  • TNS-12546

    HI All, This is a Prod Environment I am trying to embedd the parameter tcp.invited_nodes and assign the respective IP's in the sqlnet.ora and restart the listener services. But it is failing with the below error TIMESTAMP * CONNECT DATA [* PROTOCOL I