Driving Tables

From Oracle 9i onwards, is it necessary to take care of the sequence of Driving Tables in the SQL query
Or the default optimizer (cost based) is taking care of that?

Hi,
Always set your driving table
The driving table is the table that is first used by Oracle in processing the query. The driving table should always be the table in the query that returns the smallest number of rows.
The table order still makes a difference in execution time, even when using the cost-based optimizer.
The driving table is the table that will initiate the query and should be the table with the smallest number of rows. Ordering the tables in the FROM clause can make a huge difference in execution time
The driving table is first after FROM clause - place smallest table first after FROM, and list tables from smallest to largest.
When it comes for Rule Based :-
If you join two tables, the rule-based optimizer needs to select a driving table. The table selected can have a significant impact on performance, particularly when the optimizer decides to use nested loops. A row will be returned from the driving table, and then the matching rows selected from the other table. It is important that as few rows as possible are selected from the driving table.
The rule-based optimizer uses the following rules to select the driving table:
A unique or primary key index will always cause the associated table to be selected as the driving table in front of a non-unique or non-primary key index.
An index for which you apply the equality operator (=) to all columns will take precedence over indexes from which you use only some columns, and will result in the underlying table being chosen as the driving table for the query.
The table that has a higher percentage of columns in an index will override the table that has a lesser percentage of columns indexed.
A table that satisfies one two-column index in the WHERE clause of a query will be chosen as the driving table in front of a table that satisfies two single-column indexes.
If two tables have the same number of index columns satisfied, the table that is listed last in the FROM clause will be the driving table. In the SQL below, the EMP table will be the driving table because it is listed last in the FROM clause.
- Pavan Kumar N

Similar Messages

  • I NEED TO KNOW ABOUT DRIVING TABLE...PLEASE

    Well, My name is Adan. I am from Panama.. my english is not
    good. But I'll try. I need to know about driving tables and how
    have to choose a driving table and how optimizer proccess an sql
    statment.
    Example:
    Employees have (1,000,000 rows),
    dept have (100 rows)
    Category have (100 rows)...
    I need retrieved all employees with category and dept name for
    those employee with salary > 100000
    Well, What is the driving table and where i have to put this one
    in the from clause ? What about order in the where predicate...
    First ?
    Select E.name, C.category, D.Departement
    from Employees e, dept d, category c
    where
    and d.cat = c.cat
    and e.deptno = d.deptno
    and e.salary > 100000
    Last ?
    Select E.name,C.category, D.Departement
    from dept d, category c ,Employees e
    where
    and d.cat = c.cat
    and e.deptno = d.deptno
    and e.salary > 100000
    I apreciate your help....Thanks and sorry for my english....
    Bye..

    Adam,
    If you set your optimizer = choose and analyze the tables and
    indexes to generate statistics, then your system can use the
    Cost Based Optimizer (CBO) and, like David said, it will
    automatically choose the best access path, and the order of
    things will not matter.
    If your optimizer is not set to choose or if there are no
    statistics, then it will use the Rule Based Optimizer (RBO), in
    which case, the only thing that matters is the order of the
    tables in the from clause. When using RBO, the driving table
    should be at the end of the from clause, in the right-most
    position. The driving table is the one such that, after the
    restrictions have been applied, returns the smallest number of
    rows. You would have to compare the number of rows in the
    employees table where salary > 100000 to the number of rows in
    the dept table (100) and the number of rows in the category
    table (100).
    In RBO, if there are more than 100 rows in the employees table
    where salary > 100000, then your from clause would be:
    FROM employees e, dept d, category c
    In RBO, if there are less than 100 rows in the employees table
    where salary > 100000, then your from clause would be:
    FROM category c, dept d, employees e
    This is all that applies to the example you have given, however
    there are other things that can apply in other situations. For
    example, if there is an outer join to a table, the table that
    has the (+) cannot be used as the driving table.
    Barbara

  • Inner join driving table

    Hi,
    we have 2 dimension tables and 1 fact table. So our physical query looks like the below:
    Select a, b, c....
    from
    BC_CTR T89740,
    M_CTR T49296,
    BC_M_FCT T59920
    where
    T49296.CTR = T59920.M_CTR and
    T89740.CTR = T59920.BC_CTR
    The problem we face is that BC_CTR table has 300,000 rows. We want OBI to first query on BC_M_FCT and M_CTR tables and then query on BC_CTR table. So query should do something like the below:
    Select a, b, c....
    from
    BC_CTR T89740 inner join
    (M_CTR T49296 inner join BC_M_FCT T59920 on T49296.CTR = T59920.M_CTR) on T89740.CTR = T59920.BC_CTR
    I tried setting Driving table in BMM to the fact table but this is not changing the query. How can I force the query to be changed ?
    Thanks,
    Sheela

    In the property of a dimension level, you have a field "number of elements at this level" (a count).
    Check here :
    http://download.oracle.com/docs/cd/E12103_01/books/admintool/admintool_BusModSetup20.html
    and serach "number of elements"
    It's an equivalent to the number of rows. Therefore if you fill in in the lowest level, it's the number of rows in your table.
    The documentation said that :
    "This number is used by the Analytics Server when picking aggregate sources. The number does not have to be exact, but ratios of numbers from one logical level to another should be accurate"
    But if you think that a table is an aggregate source at the lowest level, it can MAY BE influence the query.
    I never try.
    But I repeat the best way to improve your query is to gather your database statistics :
    http://gerardnico.com/wiki/database/oracle/oracle_db_statistics
    because the database will rewrite your sql in any way and you will see no improvement.

  • Nested Loop and Driving Table.

    In the documentation I read these (/B19306_01/server.102/b14211/optimops.htm#i82080).
    The optimizer uses nested loop joins when joining small number of rows, with a good driving condition between the two tables. You drive from the outer loop to the inner loop, so the order of tables in the execution plan is important.
    The outer loop is the driving row source. It produces a set of rows for driving the join condition. The row source can be a table accessed using an index scan or a full table scan. Also, the rows can be produced from any other operation. For example, the output from a nested loop join can be used as a row source for another nested loop join.>
    I need some help to understand the bold line, i.e. so the order of tables in the execution plan is important.
    There are various conflicting opinion about the driving table (some says smaller and some says larger table is good option) and unfortunately I did not understand any of those logic.
    I read these threads/blogs also.
    CBO (optimizer) nest-loop join question
    http://hoopercharles.wordpress.com/2011/03/21/nested-loops-join-the-smaller-table-is-the-driving-table-the-larger-table-is-the-driving-table/
    In practice, I have seen explain plan for select e.ename,d.dname
      2  from emp e, dept d
      3  where e.deptno=d.deptno; usages emp as driving table (I only understood part of Aman's logic that dept table access would be faster when there would be an index available over it and hence it is in the inner loop)
    Whereas, SQL> explain plan for
      2  select e.ename,d.dname
      3  from emp e, dept d
      4  where e.deptno=d.deptno
      5  and e.deptno=20; usages dept as driving table.
    I have use USE_NL_WITH_INDEX with LEADING hint to change it, but it is giving some adverse effect (sometimes with optimizer_mode ALL_ROWS it is ignoring the hint completely).
    so the order of tables in the execution plan is important. How can I determine it ? I have read Tom's effective oracle by design but there is also no solution.

    Not sure I quite understand the question.
    Both threads contain lots of useful information about the broad considerations in play and debunking any myths.
    I need some help to understand the bold line, i.e.
    "so the order of tables in the execution plan is important"I read this as meaning just what it says, i.e. read the execution plan carefully and that
    NESTED LOOP
      A
      Bis not the same as
    NESTED LOOP
      B
      AA 10053 trace would normally be quite verbose about it's considerations as to join order.

  • Please need yours remarks.[Why dept is not considering as a driving table i

    Its here..
    Why dept is not considering as a driving table in NL
    Khurram                                                                                                                                                                                                                   

    I suppose posting links to your original question
    everywhere is marginally better than posting the
    original question everywhere.
    Agreed but i was not getting the response over there so its better to post the link instead reposting the same thread here.
    In any case I tried to answer the original.Thanx for you effort which still not satisfactory.
    Khurram

  • Driving table....

    hi ,
    what is a driving table when we talk about sql execution?if possible please explain with some exaMPLE.
    thanks and regards,
    Aman....

    Hi,
    If you join two tables, the optimizer needs to select a driving table. The table selected can have a significant impact on performance, particularly when the optimizer decides to use nested loops. A row will be returned from the driving table, and then the matching rows selected from the other table. It is important that as few rows as possible are selected from the driving table.
    When you have accurate statistics available for the tables, it is easy for optimizer to decide which table to make driving table. So that is importance of analyzing all tables of database.
    You can use ordered hint to drive query operations and decide which table to make driving table.
    Dilipkumar Patel.

  • All the data in driving table should be displayed - obiee 10g

    Hi All,
    Table T1
    Col1 col2
    A AA1
    B BB1
    C CC1
    D DD1
    Table T2
    col1 Col2 col3
    A 200 01-DEC-2012
    B 300 03-DEC-2012
    D 250 05-DEC-2012
    Result to be:
    A 200 01-DEC-2012
    B 300 03-DEC-2012
    C
    D 250 05-DEC-2012
    When we pass date parameter from 01-DEC to 05-DEC
    Then the result we are getting is
    A 200 01-DEC-2012
    B 300 03-DEC-2012
    D 250 05-DEC-2012
    We need to get all the records from Table T1 irrespective of whether the records present in Table T2 or not.
    we tried joins but didnt worked..
    Thanks.

    If these are physically mapped then change the join inner to to Left outer or else you can go with
    For logical source 'product p1' properties->General tab
    Click on Add button and select ' product_group p2' and set Type as 'Left Outer'
    If these tables are with complex join then double click on join mapping to get join wizard->Select table at 'Driving' and 'Type' Left outer or Right Outer.
    Do these in BMM layer.
    If helps pls mark

  • Usecase for Tree as master driving Table detail - cannot complete - help!

    I'm trying to create a tree based on a self referencing table to drive a detail table. The tree works on the lower levels of the tree but not the top level of the tree. My setup is as follows; For the tree
    View Object 'Organization' based on SQL Query:
    select org_identifier, org_name, org_parent_company,
    from organizations
    org_parent_company is the self referencing attribute to org_identifier
    I also have a viewlink as below:
    Source attribute: organisations org_identifier
    Target attribute: organisations.parent_org
    Source accessor : in view object: organiszations
    Accessor name: ParentOrganizations
    Destination Accessor; in view object: organizations
    Accessor Name: Organizations
    My datamodel is as below where CompanyWorkPermits is the detail view object
    DataModel
    Available View Objects:
    Organizations
    ---->Organizations via OrganizationsToOrganizations
    ---->CompanyWorkPermits via OrgsToWorkPermits
    DataModel:
    Organizations
    ---->Organization1
    ---------->CompanyWorkPermits
    On the page I drop Organizations from the Data Control Panel to the page as a tree
    I add a new level on the tree control that adds the self referencing organization level.
    On the page I also add drag the detail Item CompanyWorkPermits as a table.
    I create a PPR trigger from the table back to the tree, so when I click on the tree the table updates.
    The issue is that the top level of the tree does not update the table, only the lower tree levels.
    Because the detail view object and table references the Organization1 view object instance.
    I can't seem to add the organzation view object as the same instance to drive the detail table, JDEV always add's a numeric number to my view object instance.
    Has anyone come across this usecase?
    Regards
    Orlando Kelly
    Cayman Islands Government.

    Hi..
    hope following will help
    http://andrejusb.blogspot.com/2009/11/tree-table-component-in-oracle-adf.html

  • The master table of a materialized view

    Hi Everybody,
    I have in my database a snapshot created on multiple tables, like this:
    create materialized view <some_name>
    as select <some_fields>
    from a,b, c
    where <some_join_conditions>
    Questions:
    1. What "algorithm" uses Oracle to determine the master table of the snapshot? The master table visible in USER_SNAPSHOTS?
    2. How can I change the master table chosed by Oracle with the table I want? I tried using some tuning hints (for example "leading table") but it is not working.
    The table I want to force as master table is a remote one accessed by dblink. Does this change anything?
    Thank you very much.
    Daniela

    We had issue with similar probelm and found that driving table is becoming master table, which was last table on your from clause (c).
    However the Query Optimizer is COST based, and we are not sure this holds true forever.
    We are looking at these answers too.

  • Need some help with the Table Function Operator

    I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
    I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
    -- Source Table:
    DROP TABLE "ZZZ_ROOM_MASTER_EX";
    CREATE TABLE "ZZZ_ROOM_MASTER_EX"
    ( "ID" NUMBER(8,0),
    "ROOM_NUMBER" VARCHAR2(200),
    "FEATURES" VARCHAR2(4000)
    -- Example Data:
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
    -- Destination Table:
    DROP TABLE "ZZZ_ROOM_FEATURES_EX";
    CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
    ( "ROOM_NUMBER" VARCHAR2(200),
    "FEATUREID" NUMBER(8,0),
    "QUANTITY" NUMBER(8,0)
    -- Types for output table:
    CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
    ID NUMBER(8,0),
    QUANTITY NUMBER(8,0)
    CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
    -- Package Dec:
    CREATE OR REPLACE
    PACKAGE ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
    END ZZZ_SANDBOX_EX;
    -- Package Body:
    CREATE OR REPLACE
    PACKAGE BODY ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
    AS
    RETURN_VALUE FK_Table_EX := FK_Table_EX();
    i NUMBER(8,0) := 0;
    BEGIN
    -- TODO: Put some real code in here that will actually read the
    -- input string, parse it out, and put data in to RETURN_VALUE
    WHILE(i < 3) LOOP
    RETURN_VALUE.EXTEND;
    RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
    i := i + 1;
    END LOOP;
    RETURN RETURN_VALUE;
    END UNFK;
    END ZZZ_SANDBOX_EX;
    I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
    I can get the data from my source table to my destination table using the following SQL statement:
    -- from source table joined with table function
    INSERT INTO ZZZ_ROOM_FEATURES_EX(
    ROOM_NUMBER,
    FEATUREID,
    QUANTITY)
    SELECT
    ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
    UNFK.ID,
    UNFK.QUANTITY
    FROM
    ZZZ_ROOM_MASTER_EX,
    TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
    Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
    INSERT
    /*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
    INTO
    "ZZZ_ROOM_FEATURES_EX"
    ("ROOM_NUMBER",
    "FEATUREID",
    "QUANTITY")
    (SELECT
    "ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
    "INGRP2"."ID" "ID_1",
    "INGRP2"."QUANTITY" "QUANTITY"
    FROM
    (SELECT
    "UNFK"."ID" "ID",
    "UNFK"."QUANTITY" "QUANTITY"
    FROM
    TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
    "ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
    As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
    Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Filter issues with hidden/visible  columns on a table

    OK, 1st post to this forum:
    This is based on:
    http://labs.adobe.com/technologies/spry/samples/data_region/SpryPagedViewSample.html
    I have a contact list that has contact info on it (office
    phone, home phone, cell phone, etc). There are several hundred
    entries in the .xml file. As a default, I am putting the contacts
    in a table that has the office phone and email address visible, and
    the other info hidden. I have a "ShowDetail" checkbox that will
    allow the hidden columns to be visible and vice versa by using the
    addClassName and removeClassName.
    The issue I have, is that when you start typing in an contact
    name when the checkbox is checked, the table flashes the correct
    info up with the columns visible, but then the HTML is rendered and
    the Hidden class is reassigned to the columns.
    Is there anyway to run the javascript function that toggles
    the class after the HTML is rendered based on the checked status of
    the checkbox? Thanks for any help!

    Thanks for the reponse. However here is the syntax I need to edit
    SELECT u.user# as "UID",
    lower(u.name) as owner,
    lower(t.name) as table_name,
    col.col# as column_id,
    lower(col.name) as column_name,
    decode(col.type#,
    1, 'varchar2',
    2, decode(col.scale,
    null, decode(col.precision#, null, 'number', 'float'),
    'number'),
    8, 'long',
    9, 'varchar',
    12, 'date',
    23, 'raw',
    24, 'long raw',
    69, 'rowid',
    96,'char',
    105, 'mlslabel',
    106, 'mlslabel',
    'undefined') as data_type, /* these decodes come from the view */
    /* definition for DBA_TAB_COLUMNS */
    /* in CATALOG.SQL for version 7.3 */
    /* the next two decodes are derived from the actual queries performed by Storage */
    /* when Manager retrieving column information. */
    decode(nvl(col.precision#, 0),
    0, col.length,
    nvl(col.precision#,0)) as data_length,
    to_number(decode(nvl(col.precision#, 0),
    0, null,
    decode(col.type#,
    2, nvl(col.scale,-127/*MAXSB1MINAL*/),
    0) ) ) as scale,
    decode(col.null$, 1, 'n', null) as nulls,
    'y' as in_primary_key
    FROM sys.col$ col,
    sys.obj$ t,
    sys.user$ u
    WHERE u.user# = t.owner# /* user$ will be the driving table because no index on user# */
    AND t.obj# = col.obj#
    AND u.name = 'POWERSELLER' /* We only care about PowerSeller tables/columns; */
    AND t.type# in (2, 4) /* Tables and views only */
    AND EXISTS (SELECT 1
    FROM sys.ccol$ ns_ccol,
    sys.cdef$ ns_cdef,
    sys.obj$ ns_t,
    sys.user$ ns_u
    WHERE ns_u.user# = ns_t.owner#
    AND ns_t.obj# = ns_cdef.obj#
    AND ns_cdef.con# = ns_ccol.con#
    AND ns_u.name = 'POWERSELLER'
    AND ns_cdef.type# = 2 /* primary key constraint */
    AND ns_cdef.enabled is not null
    AND ns_ccol.obj# = t.obj# /* using ns_ccol instead of ns_t */
    /* does 70% as many logical reads */
    AND ns_ccol.col# = col.col#
    )

  • Best Practice - Outer Join between Fact and Dim table

    Hi Gurus,
    Need some advice on the below scenario
    I have an OOTB subject area and we have around 50-60 reports based on it. The related subject area Fact and Dim1 table are having inner join.
    Now I have a scenario for one report where outer join has to be implemented between Fact and Dim1. Here I am against changing the OOTB subject area join as the outer join will impact the performance of other 50-60 reports.
    Can anyone provide any inputs on what is the best way to handle this scenario?
    Thanks

    Ok. I tried this:
    Driving table : Fact, Left outer join -- didnt work.
    Driving table: Dimension D left outer join -- didnt work either
    In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
    And then I tried this -
    Driving table: Fact, RIght outer join.
    Now, this is giving me error:
    Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
    I checked all columns, everything matched with database table type and size.
    I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number.

  • Delete records from multiple table

    Hi,
    I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
    Kindly Help.
    Thanks,
    Alexander.

    Hi Tim,
    Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
    Technically, there are other ways of deleting from multiple tables with one statement.
    1. "Use a trigger":
    What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
    This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
    2. Dynamic SQL:
    Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
    3. Using Foreign-Key constraint with Cascade-Delete:
    This I feel is a more 'cleaner' way of doing this.
    Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
    Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
    IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind.

  • How to design universe with tables from two databases using a db link?

    I am building a universe (v3.1) that has tables from two different oracle db instances.  My dba created synonyms for me and there is a database link in place.  I don't know how to get this working in Designer.  I can see the views under my ID when I browse to insert a table, but there is no structure.  I think I have to create a new strategy.  I attempted to do that, but the directions aren't very clear to me, and it isn't working.  Any help or advice would be greatly appreciated.  Thanks!!

    i've been working with DB links much before, but this was since long time ago before i join the Business Intelligence field
    from my understanding that you Have link from DB1 to DB2
    and from your user in DB1 you can access tables and view from DB2
    if you are using your user to create a universe im not sure if you can use tables from DB2 or not
    and you dont see the tables of the link in the Universe
    but you can try to create a drived table selecting from any tables from DB2
    for example
    select id,name from user.table2@mylink
    check this way and give me your feedback
    good luck

  • Partition pruning not working for partitioned table joins

    Hi,
    We are joining  4 partitioned tables on partition column & other key columns. And we are filtering the driving table on partition key. But explain plan is showing that all tables except the driving table are not partition pruning and scanning all partitions.Is there any limitation that filter condition cannot be dynamic?
    Thanks a lot in advance.
    Here are the details...
    SELECT a.pay_prd_id,
                  a.a_id,
                  a.a_evnt_no
      FROM b,
                c,
                a,
                d
    WHERE  (    a.pay_prd_id = b.pay_prd_id ---partition range all
                AND a.a_evnt_no  = b.b_evnt_no
                AND a.a_id       = b.b_id
       AND (    a.pay_prd_id = c.pay_prd_id---partition range all
            AND a.a_evnt_no  = c.c_evnt_no
            AND a.a_id       = c.c_id
       AND (    a.pay_prd_id = d.pay_prd_id---partition range all
            AND a.a_evnt_no  = d.d_evnt_no
            AND a.a_id       = d.d_id
       AND (a.pay_prd_id =  ---partition range single
               CASE '201202'
                  WHEN 'YYYYMM'
                     THEN (SELECT min(pay_prd_id)
                                      FROM pay_prd
                                     WHERE pay_prd_stat_cd = 2)
                  ELSE TO_NUMBER ('201202', '999999')
               END
    DDLs.
    create table pay_prd
    pay_prd_id number(6),
    pay_prd_stat_cd integer,
    pay_prd_stat_desc varchar2(20),
    a_last_upd_dt DATE
    insert into pay_prd
    select 201202,2,'OPEN',sysdate from dual
    union all
    select 201201,1,'CLOSE',sysdate from dual
    union all
    select 201112,1,'CLOSE',sysdate from dual
    union all
    select 201111,1,'CLOSE',sysdate from dual
    union all
    select 201110,1,'CLOSE',sysdate from dual
    union all
    select 201109,1,'CLOSE',sysdate from dual
    CREATE TABLE A
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    A_ID        NUMBER(9) NOT NULL,
    A_EVNT_NO    NUMBER(3) NOT NULL,
    A_DAYS        NUMBER(3),
    A_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION A_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE A ADD CONSTRAINT A_PK PRIMARY KEY (PAY_PRD_ID,A_ID,A_EVNT_NO) USING INDEX LOCAL;
    insert into a
    select 201202,1111,1,65,sysdate from dual
    union all
    select 201202,1111,2,75,sysdate from dual
    union all
    select 201202,1111,3,85,sysdate from dual
    union all
    select 201202,1111,4,95,sysdate from dual
    CREATE TABLE B
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    B_ID        NUMBER(9) NOT NULL,
    B_EVNT_NO    NUMBER(3) NOT NULL,
    B_DAYS        NUMBER(3),
    B_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION B_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE B ADD CONSTRAINT B_PK PRIMARY KEY (PAY_PRD_ID,B_ID,B_EVNT_NO) USING INDEX LOCAL;
    insert into b
    select 201202,1111,1,15,sysdate from dual
    union all
    select 201202,1111,2,25,sysdate from dual
    union all
    select 201202,1111,3,35,sysdate from dual
    union all
    select 201202,1111,4,45,sysdate from dual
    CREATE TABLE C
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    C_ID        NUMBER(9) NOT NULL,
    C_EVNT_NO    NUMBER(3) NOT NULL,
    C_DAYS        NUMBER(3),
    C_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION C_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE C ADD CONSTRAINT C_PK PRIMARY KEY (PAY_PRD_ID,C_ID,C_EVNT_NO) USING INDEX LOCAL;
    insert into c
    select 201202,1111,1,33,sysdate from dual
    union all
    select 201202,1111,2,44,sysdate from dual
    union all
    select 201202,1111,3,55,sysdate from dual
    union all
    select 201202,1111,4,66,sysdate from dual
    CREATE TABLE D
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    D_ID        NUMBER(9) NOT NULL,
    D_EVNT_NO    NUMBER(3) NOT NULL,
    D_DAYS        NUMBER(3),
    D_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION D_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE D ADD CONSTRAINT D_PK PRIMARY KEY (PAY_PRD_ID,D_ID,D_EVNT_NO) USING INDEX LOCAL;
    insert into c
    select 201202,1111,1,33,sysdate from dual
    union all
    select 201202,1111,2,44,sysdate from dual
    union all
    select 201202,1111,3,55,sysdate from dual
    union all
    select 201202,1111,4,66,sysdate from dual

    Below query generated from Business Objects and submitted to Database (the case statement is generated by BO). Cant we use Case/Subquery/Decode etc for the partitioned column? We are assuming that  the case causing the issue to not to dynamic partition elimination on the other joined partitioned tables (TAB_B_RPT, TAB_C_RPT).
    SELECT TAB_D_RPT.acvy_amt,
           TAB_A_RPT.itnt_typ_desc,
           TAB_A_RPT.ls_typ_desc,
           TAB_A_RPT.evnt_no,
           TAB_C_RPT.pay_prd_id,
           TAB_B_RPT.id,
           TAB_A_RPT.to_mdfy,
           TAB_A_RPT.stat_desc
      FROM TAB_D_RPT,
           TAB_C_RPT fee_rpt,
           TAB_C_RPT,
           TAB_A_RPT,
           TAB_B_RPT
    WHERE (TAB_B_RPT.id = TAB_A_RPT.id)
       AND (    TAB_A_RPT.pay_prd_id = TAB_D_RPT.pay_prd_id -- expecting Partition Range Single, but doing Partition Range ALL
            AND TAB_A_RPT.evnt_no    = TAB_D_RPT.evnt_no
            AND TAB_A_RPT.id         = TAB_D_RPT.id
       AND (    TAB_A_RPT.pay_prd_id = TAB_C_RPT.pay_prd_id -- expecting Partition Range Single, but doing Partition Range ALL
            AND TAB_A_RPT.evnt_no    = TAB_C_RPT.evnt_no
            AND TAB_A_RPT.id         = TAB_C_RPT.id
       AND (    TAB_A_RPT.pay_prd_id = fee_rpt.pay_prd_id -- expecting Partition Range Single
            AND TAB_A_RPT.evnt_no    = fee_rpt.evnt_no
            AND TAB_A_RPT.id         = fee_rpt.id
       AND (TAB_A_RPT.rwnd_ind = 'N')
       AND (TAB_A_RPT.pay_prd_id =
               CASE '201202'
                  WHEN 'YYYYMM'
                     THEN (SELECT DISTINCT pay_prd.pay_prd_id
                                      FROM pay_prd
                                     WHERE pay_prd.stat_cd = 2)
                  ELSE TO_NUMBER ('201202', '999999')
               END
    And its explain plan is...
    Plan
    SELECT STATEMENT ALL_ROWS Cost: 79 K Bytes: 641 M Cardinality: 3 M
    18 HASH JOIN Cost: 79 K Bytes: 641 M Cardinality: 3 M
    3 PART JOIN FILTER CREATE SYS.:BF0000 Cost: 7 K Bytes: 72 M Cardinality: 3 M
    2 PARTITION RANGE ALL Cost: 7 K Bytes: 72 M Cardinality: 3 M Partition #: 3 Partitions accessed #1 - #1048575
    1 TABLE ACCESS FULL TABLE TAB_D_RPT Cost: 7 K Bytes: 72 M Cardinality: 3 M Partition #: 3 Partitions accessed #1 - #1048575
    17 HASH JOIN Cost: 57 K Bytes: 182 M Cardinality: 874 K
    14 PART JOIN FILTER CREATE SYS.:BF0001 Cost: 38 K Bytes: 87 M Cardinality: 914 K
    13 HASH JOIN Cost: 38 K Bytes: 87 M Cardinality: 914 K
    6 PART JOIN FILTER CREATE SYS.:BF0002 Cost: 8 K Bytes: 17 M Cardinality: 939 K
    5 PARTITION RANGE ALL Cost: 8 K Bytes: 17 M Cardinality: 939 K Partition #: 9 Partitions accessed #1 - #1048575
    4 TABLE ACCESS FULL TABLE TAB_C_RPT Cost: 8 K Bytes: 17 M Cardinality: 939 K Partition #: 9 Partitions accessed #1 - #1048575
    12 HASH JOIN Cost: 24 K Bytes: 74 M Cardinality: 957 K
    7 INDEX FAST FULL SCAN INDEX (UNIQUE) TAB_B_RPT_PK Cost: 675 Bytes: 10 M Cardinality: 941 K
    11 PARTITION RANGE SINGLE Cost: 18 K Bytes: 65 M Cardinality: 970 K Partition #: 13 Partitions accessed #KEY(AP)
    10 TABLE ACCESS FULL TABLE TAB_A_RPT Cost: 18 K Bytes: 65 M Cardinality: 970 K Partition #: 13 Partitions accessed #KEY(AP)
    9 HASH UNIQUE Cost: 4 Bytes: 14 Cardinality: 2
    8 TABLE ACCESS FULL TABLE PAY_PRD Cost: 3 Bytes: 14 Cardinality: 2
    16 PARTITION RANGE JOIN-FILTER Cost: 8 K Bytes: 106 M Cardinality: 939 K Partition #: 17 Partitions accessed #:BF0001
    15 TABLE ACCESS FULL TABLE TAB_C_RPT Cost: 8 K Bytes: 106 M Cardinality: 939 K Partition #: 17 Partitions accessed #:BF0001
    Thanks Again.

Maybe you are looking for

  • Aging - 7 Bucket - By Collector Report

    Hi , Can anyone help me how to create Standard Report 6i (Aging - 7 Bucket - By Collector Report) in Discoverer 10g. Regards, Sushant

  • Credit Blueprint!

    Good Morning! With the recent addition to our family, our daughter, now of 3 months. We are starting to look at new houses. Our plan is in 2 years or sooner. Wifes credit is A+ .. I need to get mine up there! If I post the details of my credit report

  • Fetching Scenario and Channel details w.r.t a System?

    Hello All, I have a requirement to retrieve the "configuration scenario" and "communication channel" with respect to a Business System. Do we have a webservice/API which does this ? Is there any way out? Regards Dhanya Nair

  • Object layering opacity glitch?

    Hello, I am having some trouble with a file in Illustrator CS6. Within a layer, when I add a fill to an object, the fill doesn't block out the object paths beneath. For instance, say I have a square object overlapping a circle object in Layer 1. The

  • Ctrl + T will not work

    firefox new upgrade will not let new (untitled) tab to open. I'm using windows vista with firefox Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.15) Gecko/20110303 AskTbBLT/3.11.3.15590 Firefox/3.6.15 ( .NET CLR 3.5.30729; .NET4.0C)