Hierarchy with FWD "table  per child" FK column generation problem

I just faced with the problem which is described though example below:
Entity A is superype including subtypes B, C and it contains primary Id attribute which is inherited by the subtypes. There is also D entity which has 1:M relation to A. When the relation model is generated there is only one column represents this relation. It’s fine when FWD “Single table” in use, but in this case the single foreign key column serves the foreign key to the different tables (B & C). There is no error from the formal DDL, but logically this “foreign key” values are mutually exclusive as the uniqueness is set on supertype level and subtype instances should have different Id value. I’d suggest that the relation attribute produces two different foreign key columns, one per each constraint. Is it possible to do that in SQL DM?

Hi,
thanks for feedback. We have bug logged on that.
Philip

Similar Messages

  • Problem in hierarchy with sap table

    One problem regarding tree hierarchy  with the sap bi table example zmaterial  which is  having  3 fields which should show as node and there data as sub node suggest me , how to do it I have look around the example but there are of simple node with string concept none of them is of sap table

    Hi Sarfaraz,
    Go throgh these example programs.
    WDR_TEST_TREE
    WDT_TREE_TABLE_BY_KEY
    and also go throgh this blog.
    Dynamic Tree in ABAP WebDynpro
    also check this wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdabap/organization%2bhierarchy%2bin%2btree%2bstructure%2bas%2bf4%2bhelp
    Edited by: suman kumar chinnam on Oct 17, 2008 10:04 AM

  • Show Data as percent of Column with static table

    Hello,
    I have a problem calculating a % in a table. I have two columns in criteria tab:
    Departments and measure
    I need an extra column that calc % of total departments for each department. I know that I can do it with pivot table creating a new column and put: Show Data --> as Percent of --> Column but I need to do with static table.
    Is possible to do it??
    Thanks!!!

    Alex,
    You could try the following example here :
    http://www.biconsultinggroup.com/knowledgebase.asp?CategoryID=198&SubCategoryID=364
    using sum( measure by dimension attribute)
    This should give you access to the grand total in the report as a column, from which you can derive % of.
    HTH, if correct please mark answered / award points as you see fit to do so!!
    Alastair

  • Join with another table in pre-query

    Hi,
    We have a large data block and we need to order some columns based on street name for example, not id. The base table of db block contains an id_street column, and 'streets' table contains id and name.
    Ok, in pre-query trigger of that block, we have a complex logic and we dynamically build the where clause. At the end, we set the order_By clause of the block, to order the rows, for example we need to order by the 'my_date' column asc (it's a date type column), and street desc; but street NAME, not id. We don't want to use a from clause query, because the dynamically where clause logic it's complex.
    How can we join the db block table with 'streets' table in pre-query, so when constructing the order by clause to specify something like
    set_block_property('ADRESE_NEZONATE', order_by, 'my_date, name desc');where 'name' is the name of the street, from the 'streets' table.
    Is it possible in pre-query, somehow? Or, in my case where can I join with that table and use that column in pre-query at setting order by?
    Thanks!
    Edited by: Roger25 on 26.04.2013 12:31

    I understand what you say but partially.. please explain in more detail how to do that;
    How should look the adrese_nezonate block, then? I have to add a 'name' column and set copy value from item property to 'STREETS.NAME', and database_property No?
    Then the post-query trigger how should look like (the order by clause)? The post-query sends the entire query (with where/order by clauses) to the server, but in that "select... where... order by" (built dynamically) there are only columns from that block (adrese_nezonate). I need to join with streets, INSIDE that query.
    Thanks.

  • Problem in selection from data base with RANGE-TABLE.

    Dear folks,
                   I am facing weird problem with range table in selection query.I have problem with bold part of code.Here when i give input to both ranges r_salesno,r_brandid then and the selection occurs ,when i put black in one of those it does not work.I haev passed Empty table to range if no inpiut in elements..although it does not work..I dont know why it is happening...By the i m using this code in Webdynpro ABAP.Please help points will be awarded..
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = space.
        APPEND wa_salesno TO r_salesno.
         CLEAR : wa_salesno .
      endif.
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
         wa_brandid-LOW = space.
        APPEND wa_brandid  TO  r_brandid.
        CLEAR : wa_brandid  .
      endif.
    *If any of these are given then select data accordingly.
        <b>select * from ZNSLVWHDIMMD_LCL
                 into corresponding fields of table IT_VIEW
                 WHERE SALESRLNO in  r_salesno
    *             and   CREATEDBY in It_crtby_selopt
    *            and   STARTDATE in It_validfrm_selopt
    *             and   ENDDATE   in It_validto_selopt
    *             and  STATUS     in It_status_selopt1
                 and   BRANDID   in r_brandid.
    *             and   MODELNO   in It_model_selopt.</b>

    Hello Nirad
    Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        REFRESH: r_salesno.  " means: select all sales numbers
    " NOTE: If you fill the range like below this means that only sales order
    "            with no sales number (= ' ', space) should be select.
    " Thus, there will never be any sales order selected.
    *   wa_salesno-sign = 'I'.
    *   wa_salesno-option = 'EQ'.
    *   wa_salesno-LOW = space.
    *   APPEND wa_salesno TO r_salesno.
    *    CLEAR : wa_salesno .
      endif.
    The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        REFRESH: r_brandid.  " means: select all BRANDID
    *    wa_brandid-sign = 'I'.
    *    wa_brandid-option = 'EQ'.
    *     wa_brandid-LOW = space.
    *    APPEND wa_brandid  TO  r_brandid.
    *    CLEAR : wa_brandid  .
      endif.
    Regards
      Uwe

  • Hierarchy Table - Parent/Child Value Pairs w/o Node Name

    Hi,
      Has any body worked with below senario to create a Hierarchy table through Import Manager. If so how did you do it? I followed and sucessfull with some senario's by refering the blog "MDM Import Manager: handling multiple formats of source data for hierarchy" by pandey but not with this one. This scenair is actually from help.sap.com
    Parent           Category
               Printers
    Printers      Laser
    Printers      Inkjet
    Inkjet           B&W
    Inkjet           Color
    Printers      Dot Matrix
    Dot Matrix      300 DPI
    Dot Matrix      600 DPI
    Dot Matrix      1200 DPI
    Edited by: SDN POWERED on Jun 7, 2009 8:59 PM

    Hi SDN Powered,
    For Hierarchy Table - Parent/Child Value Pairs w/o Node Name just do as follows:
    1) In the Source Hierarchy tree, select the Parent and Child field nodes which you want to use to build hierarchy.
    2) Right-click on one of the nodes and choose Create Hierarchy Field from the context menu, or choose Source > Create Hierarchy Field from the main menu.
    3) MDM opens the Create Hierarchy Field dialog box. This dialog box contains 4 feilds, viz Hierarchy Field Name, Parent Field, Child Field, and Node Name Field. In the Hierarchy Field Name, type the name for the new field.In the Parent Field, Child Field. For Parent/Child Value Pairs w/o Node Name , set the Node Name Field to None.
    4) Click OK to close the Create Hierarchy Field dialog box. The MDM Import Manager creates Hierarchy using the values you have provided.
    I hope I am able to solve your problem.
    Thanks & Regards
    Dilmit Chadha

  • Ability to query on all columns from a view with multiple tables

    I have view with 4 tables. view has about 50 columns.
    hypothetically, I want to build a form to give the user an ability to query on any of those 50 columns. user can search on one or more fields.
    what is the best way to write the query to retrieve the results without performance impact.
    please let me know if the question is not clear.

    If you want to permit them to query any of 10 fields with no restrictions, you could create 10 separate single-column indexes. The optimizer would have to try to pick the best of these indexes if you specified multiple search criteria. But since you have a view which presumably means that you've got multiple other indexes involved for the underlying join conditions, you'd probably want/need to combine the column lists of the indexes you're adding for searches with the indexes you've created for joins, which requires looking at the text of the view and figuring out the best way to optimize the 10 single-column searches. Of course, it is possible that the optimizer could chose to do something like a b-tree to bitmap conversion on multiple indexes which could allow it to use multiple independent indexes for your queries, but that's generally not ideal performance-wise.
    All this is a fancy way of saying that there probably isn't a cut and dried answer to your question. You need to figure out the queries you're trying to optimize (say, the 10 single-condition queries) and you need to figure out what set of indexes on the various underlying tables provides the best performance weighing those benefits against the cost on other side of maintenance during DML. Which is going to depend on the text of the view, the underlying tables, the existing indexes, etc.
    Justin

  • Create a Navigational Hierarchy for filtering with the Table API

    Hello,
    I've built a WAD report acourding to the how to document: "Create a Navigational Hierarchy for filtering with the Table API".
    It works great but i dont know How to make the hirarchey to show the key and the text.
    Please Advice.
    David

    Hi Kenneth,
    please have a look in the source of the executed Web Application. What is inside of the <div> with the id filter?
    You should also find a td tag with id hier_xyz with xyz the filter inside of the <div>-Tag with id filter.
    Also check whether you have a javascript error.
    Have a look on the Javascript function set_style. Perhaps you can paste it here, than I can have a look.
    Heike

  • Uix table with multiple lines per row

    Hi,
    how can I design a table that has multiple lines for one row.
    It should look like this
    row1-cell1 row1-cell2
    row1-cell3 row1-cell4
    row2-cell1 row2-cell2
    row2-cell3 row2-cell4
    Thanks a lot.
    Christian

    Christian,
    I'll scribble down a quick example off the top of my head...
    <table data:tableData="${mydata}">
    <column>
    <stackLayout>
    <link text="cell1"/>
    <link text="cell3"/>
    </stackLayout>
    </column>
    <column>
    <stackLayout>
    <link text="cell2"/>
    <link text="cell4"/>
    </stackLayout>
    </column>
    </table>
    I recommend you just play around with UIX XML, and you'll find something that works.
    Hope this helps,
    Ryan

  • Hide parents in a parent-child hierarchy with dynamic rights

    Hi all,
    I'm facing the following issue with dynamic rights on a parent-child hierarchy:
    scenario:
    - a cube with a company parent-child hierarcy
    - dynamic security on through a role on dimension data based on a list with user (login names) and their
    departments, with Enable
    Visual Total is switched ON 
    - Multiple facts connected to this hierarchy.
    When a user connects to the cube (in this case with Excel or through a dashboard in Performance Point services) he/she is allowed to see the facts belonging to theirs departments and all child departments, so far so good. But the totals of the facts are
    repeated for all higher parents. Now i know thats nog 'wrong' but our users think thats very confusing in some cases, so is there a way
    - to hide the parents in the hierarhcy
    - or to set all the parent measures to null/empty?
    I prefer to make a solution in the cube so that all client programs can benefit from this solution.
    thanx in advance for all input!

     so that User A have scope: [Dimension_Name].[Attribute XYZ] and User B: [Dimension_Name].[Attribute ABC] ?
    Hi Wilfred,
    If I understanding correctly, you want different user can see different dimension attributes based on the different right on role, right? 
    Based on my research, it seems that there is no a directly way to achieve this requirement. What we can do is that "Deselect all members" for each attribute of the dimension in Dimension Data tab, which will hide all members of the dimension for the role.
    Even the dimension metadata is visible in the cube in clients, its members can't be seen. Here are some useful links for your reference.
    http://saysmymind.wordpress.com/2013/01/15/hide-a-specific-attribute-hierarchy-in-role-playing-dimension-ssas-multidimensional/
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e2596eec-7c2d-48c0-8e81-538a8c632360/hide-dimension-based-on-roles
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Problem when expanding Tree - Tree with nested table column

    Hi, i have created the tree using the Tree with nested table column.
    I have created a node called TREE_ROOT in the context.
    This node has few attributes which includes children_loaded, is_leaf, is_expanded.
    I have created the recursive node TREE_SUB for the above node TREE_ROOT.
    In the view, i have created the table with the master column. The above attributes have been mapped accordingly. I have created the action handler for load_children.
    In this action handler method, i receive the context_element correctly. In this method, i determine the children of the selected element and the resulting children are attached to this context_element.
    But the problem is: when i add elements to context_elements in the method load_children, these
    elements get added to the node TREE_ROOT as well.
    Please help.
    thanks and best regards,
    Pramod

    I just use some types defined in this user... Well, I hope you know what is the type definition of d_period_sec,
    don't you ? I didn't ask to provide all types existed now, only types you are
    using.
    Anyhow you have been granted with execute privilege for types you are using:
    SQL> conn tau_tll/tau_tll;
    Connected.
    SQL> create or replace type d_period_sec as object (date# date);
      2  /
    Type created.
    SQL> grant execute on d_period_sec to public with grant option;
    Grant succeeded.
    SQL> conn scott/tiger
    Connected.
    SQL> CREATE OR REPLACE TYPE unit_function AS OBJECT (
      2  xi NUMBER,
      3  yi NUMBER,
      4  xe NUMBER,
      5  ye NUMBER,
      6  xm NUMBER,
      7  ym NUMBER,
      8  v NUMBER,
      9  a NUMBER,
    10  f NUMBER,
    11  descr VARCHAR2 (20)
    12  );
    13  /
    Type created.
    SQL> grant execute on unit_function to master;
    Grant succeeded.
    SQL> CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
      2  (
      3  p tau_tll.d_period_sec, -- from user TAU_TLL
      4 
      5  m unit_function
      6  )
      7  /
    Type created.
    SQL> grant execute on unit_moving_point to master;
    Grant succeeded.
    SQL> CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
      2  /
    Type created.
    SQL> grant execute on moving_point_tab to master;
    Grant succeeded.
    SQL> CREATE OR REPLACE TYPE moving_point AS OBJECT (u_tab moving_point_tab);
      2  /
    Type created.
    SQL> grant execute on moving_point to master;
    Grant succeeded.
    SQL> conn master/master
    Connected.
    SQL> CREATE TABLE MPOINTS (
      2  id NUMBER,
      3  mpoint scott.Moving_Point)
      4  NESTED TABLE mpoint.u_tab store as moving_tab;
    Table created.Rgds.

  • What is the best approach to handle multiple FK with single table.

    If two tables are joined with each other with more than one ways, for example
    MAIN table is (col1, col2,....coln, person_creator_id, person_modifier_id)
    PERSON table is (person_id, name, address,........ phone) etc
    At database level PERSON_CREATOR_FK and PERSON_MODIFIER_FK are defined.
    Objective is to create a report that shows
    col1, col2...coln, person creator name, person modifier name
    If above two objects are imported with FKs in a EUL and discoverer plus is used to create above report. On first inclusion of person name discoverer plus will ask you to pick the join (provided the checkbox to disable this feature is not checked). Once you pick 'person creator' join it will never allow you to pick person modifier name.
    One solution is two create a custom folder with query like
    select col1, col2,...coln,
    pc.name, pc.address,.... pc.phone
    pm.name, pm.address,.... pm.phone
    from main m,
    person pc,
    person pm
    where m.person_id_creator = pc.person_id
    and m.person_id_modifier = pm.person_id
    Second solution is to import the PERSON folder twice in EUL (optionally named one as perosn_creator and other as person_modifier) and manually define one join per table. i.e. join MAIN with PERSON_CREATOR on person_creator_fk and join MAIN with PERSON_MODIFIER table using person_modifier_fk.
    Now discoverer plus will let you drag Name from each person folder without needing to resolve multiple joins.
    Question is, what approach is better OR is there a better way?
    With solution 1 you will not be able to use functions on folder items.
    With solution 2 there is a EUL design overhead of including same object multiple times and then manually defining all join (or deleting unwanted joins), and this could be a problem when you have person_modifier and person_creator in nearly all tables. It could be more complicated if person table is further linked other tables and users want to see that information too. (for instance, if person address is stored in LOCATION table joined with location_id and user want to see both creator address and modifier address....now you will have to create multiple LOCATION folders).
    A third solution could be to register a function in discoverer that return person name when person_id is passed. This will work perfectly for above requirement but a down side is the report will run slower if they need filters on person names (then function will be used in where clause). Also, this solution is very specific to above scenario, it will not work if you want the report developer the freedom to pick any attribute from person table (lets say, person table contain 50 attributes then its not a good idea to register 50 functions).
    Any comments/suggestion will be appreciated.
    thanks

    Hi
    In a roundabout way you have really answered your own question :-)
    In my opinion, the best approach, although by all means not the only approach - see below) would be to have the object loaded as two folders with one join going to the first folder and the second join to the other folder. You would of course name the folders appropriately.
    Here's a workflow that I use all of the time and one that I teach when I'm giving Discoverer Administrator training. It might help you:
    1. Bring in the PERSON folder to begin with
    2. Make all necessary adjustments to bring it up to deployment standard. These adjustments would be: folder name (E.g PERSON_CREATOR), item names, item placement, default positions, default aggregation and so on.
    3. Create or assign the required lists of values
    4. Create any required calculations
    5. Create any required conditions
    6. Create the first join from this folder to MAIN.
    7. Click on the heading for the folder and press CTRL-C.
    8. Click on the heading for the business area and press CTRL-V. A second copy of the folder, complete with all of the adjustments you made earlier will be inserted into the business area.
    Note: joins are not copied, everything else is.
    9. Rename this folder to say PERSON_MODIFIED
    10. Rename the items as appropriate
    11. Add a join from this folder to MAIN - you're done
    Other ideas that I have used and work well would be to use a database view or create a complex folder. Either will work, In both cases you would need to join on some other column other than the ones you referred earlier.
    I hope this helps
    Best wishes
    Michael

  • Page built with a table does not display well in Internet Explorer.

    In Chrome and Safari it appears correctly (items are left justified in each column) while in Internet Explorer all columns are centered. Website is www.eventpowerli.com and it is the home page where we have the issue. I am new to building websites so please bear with me on this question: -) Let me know if you need addnl info. From what I have seen thus far, IE is a real problem child for more than one reason

    Honestly do not use tables for your site layouts. There is a variety of box model issues and more with IE, especially with using tables. And it is really bad form to design that way anyway.
    Tablless web design using CSS is the way it should be done and if you conform to web standards and CSS standards and best practises you will have less issues.
    http://girlswhogeek.com/tutorials/2006/create-a-tableless-css-layout Just as a basic example.

  • How to improve speed of queries that use ORM one table per concrete class

    Hi,
    Many tools that make ORM (Object Relational Mapping) like Castor, Hibernate, Toplink, JPOX, etc.., have the one table per concrete class feature that maps objects to follow structure:
    CREATE TABLE ABSTRACTPRODUCT (
        ID VARCHAR(8) NOT NULL,
        DESCRIPTION VARCHAR(60) NOT NULL,
        PRIMARY KEY(ID)
    CREATE TABLE PRODUCT (
        ID VARCHAR(8) NOT NULL REFERENCES ABSTRACTPRODUCT(ID),
        CODE VARCHAR(10) NOT NULL,
        PRICE DECIMAL(12,2),
        PRIMARY KEY(ID)
    CREATE UNIQUE INDEX iProduct ON Product(code)
    CREATE TABLE BOOK (
        ID VARCHAR(8) NOT NULL REFERENCES PRODUCT(ID),
        AUTHOR VARCHAR(60) NOT NULL,
        PRIMARY KEY (ID)
    CREATE TABLE COMPACTDISK (
        ID VARCHAR(8) NOT NULL REFERENCES PRODUCT(ID),
        ARTIST VARCHAR(60) NOT NULL,
        PRIMARY KEY(ID)
    there is a way to improve queries like
    SELECT
        pd.code CODE,   
        abpd.description DESCRIPTION,
        DECODE(bk.id,NULL,cd.artist,bk.author) PERSON
    FROM
        ABSTRACTPRODUCT abpd,
        PRODUCT pd,
        BOOK bk,
        COMPACTDISK cd
    WHERE
        pd.id = abpd.id AND
        bk.id(+) = abpd.id AND
        cd.id(+) = abpd.id AND
        pd.code like '101%'
    or like this:
    SELECT
        pd.code CODE,   
        abpd.description DESCRIPTION,
        DECODE(bk.id,NULL,cd.artist,bk.author) PERSON
    FROM
        ABSTRACTPRODUCT abpd,
        PRODUCT pd,
        BOOK bk,
        COMPACTDISK cd
    WHERE
        pd.id = abpd.id AND
        bk.id(+) = abpd.id AND
        cd.id(+) = abpd.id AND
        abpd.description like '%STARS%' AND
        pd.price BETWEEN 1 AND 10
    think in a table with many rows, then exists something inside MaxDB to improve this type of queries? like some anotations on SQL? or declare tables that extends another by PK? on other databases i managed this using Materialized Views, but i think that this can be faster just using PK, i'm wrong? the better is to consolidate all tables in one table? what is the impact on database size with this consolidation?
    note: with consolidation i will miss NOT NULL constraint at database side.
    thanks for any insight.
    Clóvis

    Hi Lars,
    i dont understand because the optimizer get that Index for TM at execution plan, and because dont use the join via KEY column, note the WHERE clause is "TM.OID = MF.MY_TIPO_MOVIMENTO" by the key column, and the optimizer uses an INDEX that the indexed column is ID_SYS, that isnt and cant be a primary key, because its not UNIQUE, follow the index columns:
    indexes of TipoMovimento
    INDEXNAME     COLUMNNAME          SORT     COLUMNNO     DATATYPE     LEN     INDEX_USED     FILESTATE     DISABLED
    ITIPOMOVIMENTO     TIPO               ASC     1          VARCHAR          2     220546          OK          NO
    ITIPOMOVIMENTO     ID_SYS               ASC     2          CHAR          6     220546          OK          NO
    ITIPOMOVIMENTO     MY_CONTA_DEBITO          ASC     3          CHAR          8     220546          OK          NO
    ITIPOMOVIMENTO     MY_CONTA_CREDITO     ASC     4          CHAR          8     220546          OK          NO
    ITIPOMOVIMENTO1     ID_SYS               ASC     1          CHAR          6     567358          OK          NO
    ITIPOMOVIMENTO2     DESCRICAO          ASC     1          VARCHAR          60     94692          OK          NO
    after i create the index iTituloCobrancaX7 on TituloCobranca(OID,DATA_VENCIMENTO) in a backup instance and get surprised with the follow explain:
    OWNER     TABLENAME     COLUMN_OR_INDEX          STRATEGY                    PAGECOUNT     
         TC          ITITULOCOBRANCA1     RANGE CONDITION FOR INDEX          5368     
                   DATA_VENCIMENTO               (USED INDEX COLUMN)          
         MF          OID               JOIN VIA KEY COLUMN               9427     
         TM          OID               JOIN VIA KEY COLUMN               22     
                                  TABLE HASHED          
         PS          OID               JOIN VIA KEY COLUMN               1350     
         BOL          OID               JOIN VIA KEY COLUMN               497     
                                       NO TEMPORARY RESULTS CREATED          
         JDBC_CURSOR_19                    RESULT IS COPIED   , COSTVALUE IS     988
    note that now the optimizer gets the index ITITULOCOBRANCA1 as i expected, if i drop the new index iTituloCobrancaX7 the optimizer still getting this execution plan, with this the query executes at 110 ms, with that great news i do same thing in the production system, but the execution plan dont changes, and i still getting a long execution time this time at 413516 ms. maybe the problem is how optimizer measure my tables.
    i checked in DBAnalyser that the problem is catalog cache hit rate (we discussed this at [catalog cache hit rate, how to increase?|;
    ) and the low selectivity of this SQL command, then its because of this that to achieve a better selectivity i must have an index with, MF.MY_SACADO, MF.TIPO and TC.DATA_VENCIMENTO, as explained in previous posts, since this type of index inside MaxDB isnt possible, i have no choice to speed this type of query without changing tables structure.
    MaxDB developers can develop this type of index? or a feature like this dont have any plans to be made?
    if no, i must create another schema, to consolidate tables to speed queries on my system, but with this consolidation i will get more overhead, i must solve the less selectivity because i think if the data on tables increase, the query becomes impossible, i see that CREATE INDEX supports FUNCTION, maybe a   FUNCTION that join data of two tables can solve this?
    about instance configuration it is:
    Machine:
    Version:       '64BIT Kernel'
    Version:       'X64/LIX86 7.6.03   Build 007-123-157-515'
    Version:       'FAST'
    Machine:       'x86_64'
    Processors:    2 ( logical: 8, cores: 8 )
    data volumes:
    ID     MODE     CONFIGUREDSIZE     USABLESIZE     USEDSIZE     USEDSIZEPERCENTAGE     DROPVOLUME     TOTALCLUSTERAREASIZE     RESERVEDCLUSTERAREASIZE     USEDCLUSTERAREASIZE     PATH     
    1     NORMAL     4194304          4194288          379464          9               NO          0               0               0               /db/SPDT/data/data01.dat     
    2     NORMAL     4194304          4194288          380432          9               NO          0               0               0               /db/SPDT/data/data02.dat     
    3     NORMAL     4194304          4194288          379184          9               NO          0               0               0               /db/SPDT/data/data03.dat     
    4     NORMAL     4194304          4194288          379624          9               NO          0               0               0               /db/SPDT/data/data04.dat     
    5     NORMAL     4194304          4194288          380024          9               NO          0               0               0               /db/SPDT/data/data05.dat
    log volumes:
    ID     CONFIGUREDSIZE     USABLESIZE     PATH               MIRRORPATH
    1     51200          51176          /db/SPDT/log/log01.dat     ?
    parameters:
    KERNELVERSION                         KERNEL    7.6.03   BUILD 007-123-157-515
    INSTANCE_TYPE                         OLTP
    MCOD                                  NO
    _SERVERDB_FOR_SAP                     YES
    _UNICODE                              NO
    DEFAULT_CODE                          ASCII
    DATE_TIME_FORMAT                      ISO
    CONTROLUSERID                         DBM
    CONTROLPASSWORD                       
    MAXLOGVOLUMES                         2
    MAXDATAVOLUMES                        11
    LOG_VOLUME_NAME_001                   /db/SPDT/log/log01.dat
    LOG_VOLUME_TYPE_001                   F
    LOG_VOLUME_SIZE_001                   6400
    DATA_VOLUME_NAME_0005                 /db/SPDT/data/data05.dat
    DATA_VOLUME_NAME_0004                 /db/SPDT/data/data04.dat
    DATA_VOLUME_NAME_0003                 /db/SPDT/data/data03.dat
    DATA_VOLUME_NAME_0002                 /db/SPDT/data/data02.dat
    DATA_VOLUME_NAME_0001                 /db/SPDT/data/data01.dat
    DATA_VOLUME_TYPE_0005                 F
    DATA_VOLUME_TYPE_0004                 F
    DATA_VOLUME_TYPE_0003                 F
    DATA_VOLUME_TYPE_0002                 F
    DATA_VOLUME_TYPE_0001                 F
    DATA_VOLUME_SIZE_0005                 524288
    DATA_VOLUME_SIZE_0004                 524288
    DATA_VOLUME_SIZE_0003                 524288
    DATA_VOLUME_SIZE_0002                 524288
    DATA_VOLUME_SIZE_0001                 524288
    DATA_VOLUME_MODE_0005                 NORMAL
    DATA_VOLUME_MODE_0004                 NORMAL
    DATA_VOLUME_MODE_0003                 NORMAL
    DATA_VOLUME_MODE_0002                 NORMAL
    DATA_VOLUME_MODE_0001                 NORMAL
    DATA_VOLUME_GROUPS                    1
    LOG_BACKUP_TO_PIPE                    NO
    MAXBACKUPDEVS                         2
    LOG_MIRRORED                          NO
    MAXVOLUMES                            14
    LOG_IO_BLOCK_COUNT                    8
    DATA_IO_BLOCK_COUNT                   64
    BACKUP_BLOCK_CNT                      64
    _DELAY_LOGWRITER                      0
    LOG_IO_QUEUE                          50
    _RESTART_TIME                         600
    MAXCPU                                8
    MAX_LOG_QUEUE_COUNT                   0
    USED_MAX_LOG_QUEUE_COUNT              8
    LOG_QUEUE_COUNT                       1
    MAXUSERTASKS                          500
    _TRANS_RGNS                           8
    _TAB_RGNS                             8
    _OMS_REGIONS                          0
    _OMS_RGNS                             7
    OMS_HEAP_LIMIT                        0
    OMS_HEAP_COUNT                        8
    OMS_HEAP_BLOCKSIZE                    10000
    OMS_HEAP_THRESHOLD                    100
    OMS_VERS_THRESHOLD                    2097152
    HEAP_CHECK_LEVEL                      0
    _ROW_RGNS                             8
    RESERVEDSERVERTASKS                   16
    MINSERVERTASKS                        28
    MAXSERVERTASKS                        28
    _MAXGARBAGE_COLL                      1
    _MAXTRANS                             4008
    MAXLOCKS                              120080
    _LOCK_SUPPLY_BLOCK                    100
    DEADLOCK_DETECTION                    4
    SESSION_TIMEOUT                       180
    OMS_STREAM_TIMEOUT                    30
    REQUEST_TIMEOUT                       5000
    _IOPROCS_PER_DEV                      2
    _IOPROCS_FOR_PRIO                     0
    _IOPROCS_FOR_READER                   0
    _USE_IOPROCS_ONLY                     NO
    _IOPROCS_SWITCH                       2
    LRU_FOR_SCAN                          NO
    _PAGE_SIZE                            8192
    _PACKET_SIZE                          131072
    _MINREPLY_SIZE                        4096
    _MBLOCK_DATA_SIZE                     32768
    _MBLOCK_QUAL_SIZE                     32768
    _MBLOCK_STACK_SIZE                    32768
    _MBLOCK_STRAT_SIZE                    16384
    _WORKSTACK_SIZE                       8192
    _WORKDATA_SIZE                        8192
    _CAT_CACHE_MINSIZE                    262144
    CAT_CACHE_SUPPLY                      131072
    INIT_ALLOCATORSIZE                    262144
    ALLOW_MULTIPLE_SERVERTASK_UKTS        NO
    _TASKCLUSTER_01                       tw;al;ut;2000*sv,100*bup;10*ev,10*gc;
    _TASKCLUSTER_02                       ti,100*dw;63*us;
    _TASKCLUSTER_03                       equalize
    _DYN_TASK_STACK                       NO
    _MP_RGN_QUEUE                         YES
    _MP_RGN_DIRTY_READ                    DEFAULT
    _MP_RGN_BUSY_WAIT                     DEFAULT
    _MP_DISP_LOOPS                        2
    _MP_DISP_PRIO                         DEFAULT
    MP_RGN_LOOP                           -1
    _MP_RGN_PRIO                          DEFAULT
    MAXRGN_REQUEST                        -1
    _PRIO_BASE_U2U                        100
    _PRIO_BASE_IOC                        80
    _PRIO_BASE_RAV                        80
    _PRIO_BASE_REX                        40
    _PRIO_BASE_COM                        10
    _PRIO_FACTOR                          80
    _DELAY_COMMIT                         NO
    _MAXTASK_STACK                        512
    MAX_SERVERTASK_STACK                  500
    MAX_SPECIALTASK_STACK                 500
    _DW_IO_AREA_SIZE                      50
    _DW_IO_AREA_FLUSH                     50
    FBM_VOLUME_COMPRESSION                50
    FBM_VOLUME_BALANCE                    10
    _FBM_LOW_IO_RATE                      10
    CACHE_SIZE                            262144
    _DW_LRU_TAIL_FLUSH                    25
    XP_DATA_CACHE_RGNS                    0
    _DATA_CACHE_RGNS                      64
    XP_CONVERTER_REGIONS                  0
    CONVERTER_REGIONS                     8
    XP_MAXPAGER                           0
    MAXPAGER                              64
    SEQUENCE_CACHE                        1
    _IDXFILE_LIST_SIZE                    2048
    VOLUMENO_BIT_COUNT                    8
    OPTIM_MAX_MERGE                       500
    OPTIM_INV_ONLY                        YES
    OPTIM_CACHE                           NO
    OPTIM_JOIN_FETCH                      0
    JOIN_SEARCH_LEVEL                     0
    JOIN_MAXTAB_LEVEL4                    16
    JOIN_MAXTAB_LEVEL9                    5
    _READAHEAD_BLOBS                      32
    CLUSTER_WRITE_THRESHOLD               80
    CLUSTERED_LOBS                        NO
    RUNDIRECTORY                          /var/opt/sdb/data/wrk/SPDT
    OPMSG1                                /dev/console
    OPMSG2                                /dev/null
    _KERNELDIAGFILE                       knldiag
    KERNELDIAGSIZE                        800
    _EVENTFILE                            knldiag.evt
    _EVENTSIZE                            0
    _MAXEVENTTASKS                        2
    _MAXEVENTS                            100
    _KERNELTRACEFILE                      knltrace
    TRACE_PAGES_TI                        2
    TRACE_PAGES_GC                        20
    TRACE_PAGES_LW                        5
    TRACE_PAGES_PG                        3
    TRACE_PAGES_US                        10
    TRACE_PAGES_UT                        5
    TRACE_PAGES_SV                        5
    TRACE_PAGES_EV                        2
    TRACE_PAGES_BUP                       0
    KERNELTRACESIZE                       5369
    EXTERNAL_DUMP_REQUEST                 NO
    _AK_DUMP_ALLOWED                      YES
    _KERNELDUMPFILE                       knldump
    _RTEDUMPFILE                          rtedump
    _UTILITY_PROTFILE                     dbm.utl
    UTILITY_PROTSIZE                      100
    _BACKUP_HISTFILE                      dbm.knl
    _BACKUP_MED_DEF                       dbm.mdf
    _MAX_MESSAGE_FILES                    0
    _SHMKERNEL                            44601
    __PARAM_CHANGED___                    0
    __PARAM_VERIFIED__                    2008-05-03 23:12:55
    DIAG_HISTORY_NUM                      2
    DIAG_HISTORY_PATH                     /var/opt/sdb/data/wrk/SPDT/DIAGHISTORY
    _DIAG_SEM                             1
    SHOW_MAX_STACK_USE                    NO
    SHOW_MAX_KB_STACK_USE                 NO
    LOG_SEGMENT_SIZE                      2133
    _COMMENT                              
    SUPPRESS_CORE                         YES
    FORMATTING_MODE                       PARALLEL
    FORMAT_DATAVOLUME                     YES
    OFFICIAL_NODE                         
    UKT_CPU_RELATIONSHIP                  NONE
    HIRES_TIMER_TYPE                      CPU
    LOAD_BALANCING_CHK                    30
    LOAD_BALANCING_DIF                    10
    LOAD_BALANCING_EQ                     5
    HS_STORAGE_DLL                        libhsscopy
    HS_SYNC_INTERVAL                      50
    USE_OPEN_DIRECT                       YES
    USE_OPEN_DIRECT_FOR_BACKUP            NO
    SYMBOL_DEMANGLING                     NO
    EXPAND_COM_TRACE                      NO
    JOIN_TABLEBUFFER                      128
    SET_VOLUME_LOCK                       YES
    SHAREDSQL                             YES
    SHAREDSQL_CLEANUPTHRESHOLD            25
    SHAREDSQL_COMMANDCACHESIZE            262144
    MEMORY_ALLOCATION_LIMIT               0
    USE_SYSTEM_PAGE_CACHE                 YES
    USE_COROUTINES                        YES
    FORBID_LOAD_BALANCING                 YES
    MIN_RETENTION_TIME                    60
    MAX_RETENTION_TIME                    480
    MAX_SINGLE_HASHTABLE_SIZE             512
    MAX_HASHTABLE_MEMORY                  5120
    ENABLE_CHECK_INSTANCE                 YES
    RTE_TEST_REGIONS                      0
    HASHED_RESULTSET                      YES
    HASHED_RESULTSET_CACHESIZE            262144
    CHECK_HASHED_RESULTSET                0
    AUTO_RECREATE_BAD_INDEXES             NO
    AUTHENTICATION_ALLOW                  
    AUTHENTICATION_DENY                   
    TRACE_AK                              NO
    TRACE_DEFAULT                         NO
    TRACE_DELETE                          NO
    TRACE_INDEX                           NO
    TRACE_INSERT                          NO
    TRACE_LOCK                            NO
    TRACE_LONG                            NO
    TRACE_OBJECT                          NO
    TRACE_OBJECT_ADD                      NO
    TRACE_OBJECT_ALTER                    NO
    TRACE_OBJECT_FREE                     NO
    TRACE_OBJECT_GET                      NO
    TRACE_OPTIMIZE                        NO
    TRACE_ORDER                           NO
    TRACE_ORDER_STANDARD                  NO
    TRACE_PAGES                           NO
    TRACE_PRIMARY_TREE                    NO
    TRACE_SELECT                          NO
    TRACE_TIME                            NO
    TRACE_UPDATE                          NO
    TRACE_STOP_ERRORCODE                  0
    TRACE_ALLOCATOR                       0
    TRACE_CATALOG                         0
    TRACE_CLIENTKERNELCOM                 0
    TRACE_COMMON                          0
    TRACE_COMMUNICATION                   0
    TRACE_CONVERTER                       0
    TRACE_DATACHAIN                       0
    TRACE_DATACACHE                       0
    TRACE_DATAPAM                         0
    TRACE_DATATREE                        0
    TRACE_DATAINDEX                       0
    TRACE_DBPROC                          0
    TRACE_FBM                             0
    TRACE_FILEDIR                         0
    TRACE_FRAMECTRL                       0
    TRACE_IOMAN                           0
    TRACE_IPC                             0
    TRACE_JOIN                            0
    TRACE_KSQL                            0
    TRACE_LOGACTION                       0
    TRACE_LOGHISTORY                      0
    TRACE_LOGPAGE                         0
    TRACE_LOGTRANS                        0
    TRACE_LOGVOLUME                       0
    TRACE_MEMORY                          0
    TRACE_MESSAGES                        0
    TRACE_OBJECTCONTAINER                 0
    TRACE_OMS_CONTAINERDIR                0
    TRACE_OMS_CONTEXT                     0
    TRACE_OMS_ERROR                       0
    TRACE_OMS_FLUSHCACHE                  0
    TRACE_OMS_INTERFACE                   0
    TRACE_OMS_KEY                         0
    TRACE_OMS_KEYRANGE                    0
    TRACE_OMS_LOCK                        0
    TRACE_OMS_MEMORY                      0
    TRACE_OMS_NEWOBJ                      0
    TRACE_OMS_SESSION                     0
    TRACE_OMS_STREAM                      0
    TRACE_OMS_VAROBJECT                   0
    TRACE_OMS_VERSION                     0
    TRACE_PAGER                           0
    TRACE_RUNTIME                         0
    TRACE_SHAREDSQL                       0
    TRACE_SQLMANAGER                      0
    TRACE_SRVTASKS                        0
    TRACE_SYNCHRONISATION                 0
    TRACE_SYSVIEW                         0
    TRACE_TABLE                           0
    TRACE_VOLUME                          0
    CHECK_BACKUP                          NO
    CHECK_DATACACHE                       NO
    CHECK_KB_REGIONS                      NO
    CHECK_LOCK                            NO
    CHECK_LOCK_SUPPLY                     NO
    CHECK_REGIONS                         NO
    CHECK_TASK_SPECIFIC_CATALOGCACHE      NO
    CHECK_TRANSLIST                       NO
    CHECK_TREE                            NO
    CHECK_TREE_LOCKS                      NO
    CHECK_COMMON                          0
    CHECK_CONVERTER                       0
    CHECK_DATAPAGELOG                     0
    CHECK_DATAINDEX                       0
    CHECK_FBM                             0
    CHECK_IOMAN                           0
    CHECK_LOGHISTORY                      0
    CHECK_LOGPAGE                         0
    CHECK_LOGTRANS                        0
    CHECK_LOGVOLUME                       0
    CHECK_SRVTASKS                        0
    OPTIMIZE_AGGREGATION                  YES
    OPTIMIZE_FETCH_REVERSE                YES
    OPTIMIZE_STAR_JOIN                    YES
    OPTIMIZE_JOIN_ONEPHASE                YES
    OPTIMIZE_JOIN_OUTER                   YES
    OPTIMIZE_MIN_MAX                      YES
    OPTIMIZE_FIRST_ROWS                   YES
    OPTIMIZE_OPERATOR_JOIN                YES
    OPTIMIZE_JOIN_HASHTABLE               YES
    OPTIMIZE_JOIN_HASH_MINIMAL_RATIO      1
    OPTIMIZE_OPERATOR_JOIN_COSTFUNC       YES
    OPTIMIZE_JOIN_PARALLEL_MINSIZE        1000000
    OPTIMIZE_JOIN_PARALLEL_SERVERS        0
    OPTIMIZE_JOIN_OPERATOR_SORT           YES
    OPTIMIZE_QUAL_ON_INDEX                YES
    DDLTRIGGER                            YES
    SUBTREE_LOCKS                         NO
    MONITOR_READ                          2147483647
    MONITOR_TIME                          2147483647
    MONITOR_SELECTIVITY                   0
    MONITOR_ROWNO                         0
    CALLSTACKLEVEL                        0
    OMS_RUN_IN_UDE_SERVER                 NO
    OPTIMIZE_QUERYREWRITE                 OPERATOR
    TRACE_QUERYREWRITE                    0
    CHECK_QUERYREWRITE                    0
    PROTECT_DATACACHE_MEMORY              NO
    LOCAL_REDO_LOG_BUFFER_SIZE            0
    FILEDIR_SPINLOCKPOOL_SIZE             10
    TRANS_HISTORY_SIZE                    0
    TRANS_THRESHOLD_VALUE                 60
    ENABLE_SYSTEM_TRIGGERS                YES
    DBFILLINGABOVELIMIT                   70L80M85M90H95H96H97H98H99H
    DBFILLINGBELOWLIMIT                   70L80L85L90L95L
    LOGABOVELIMIT                         50L75L90M95M96H97H98H99H
    AUTOSAVE                              1
    BACKUPRESULT                          1
    CHECKDATA                             1
    EVENT                                 1
    ADMIN                                 1
    ONLINE                                1
    UPDSTATWANTED                         1
    OUTOFSESSIONS                         3
    ERROR                                 3
    SYSTEMERROR                           3
    DATABASEFULL                          1
    LOGFULL                               1
    LOGSEGMENTFULL                        1
    STANDBY                               1
    USESELECTFETCH                        YES
    USEVARIABLEINPUT                      NO
    UPDATESTAT_PARALLEL_SERVERS           0
    UPDATESTAT_SAMPLE_ALGO                1
    SIMULATE_VECTORIO                     IF_OPEN_DIRECT_OR_RAW_DEVICE
    COLUMNCOMPRESSION                     YES
    TIME_MEASUREMENT                      NO
    CHECK_TABLE_WIDTH                     NO
    MAX_MESSAGE_LIST_LENGTH               100
    SYMBOL_RESOLUTION                     YES
    PREALLOCATE_IOWORKER                  NO
    CACHE_IN_SHARED_MEMORY                NO
    INDEX_LEAF_CACHING                    2
    NO_SYNC_TO_DISK_WANTED                NO
    SPINLOCK_LOOP_COUNT                   30000
    SPINLOCK_BACKOFF_BASE                 1
    SPINLOCK_BACKOFF_FACTOR               2
    SPINLOCK_BACKOFF_MAXIMUM              64
    ROW_LOCKS_PER_TRANSACTION             50
    USEUNICODECOLUMNCOMPRESSION           NO
    about send you the data from tables, i dont have permission to do that, since all data is in a production system, the customer dont give me the rights to send any information. sorry about that.
    best regards
    Clóvis

  • How to alter or add foreign key constr to table having child rows or data

    Hi,
    I have a table by name DEPT in which the column DEPTNO is a primary key column and have data in it for all the columns . Now I have a EMP table where in the column DEPTNO is not having any constraint including foreign key constraint too. Now i have data in the EMP table for all the columns . now i would like to add the foreign key constraint to DEPTNO column in the EMP table referencing the DEPTNO column in the DEPT table. Both the table do not have any null values .
    I need to add the foreign key without deleting the data in the EMP table.
    Please advice.
    Regards,
    Vinesh

    Hi,
    I need to add the foreign key without deleting the data in the EMP table.Foreign key constraint can have only those values which are present in the primary key of the parent table or null.
    When your tables are populated with values and then you are adding the constraint then,
    the parent table data is only present in child table or null values.
    Example
    SQL> create table emp_bkp as select * from emp;
    Table created.
    SQL> create table dept_bkp as select * from dept;
    Table created.
    SQL> alter table dept_bkp
      2  add constraint pk_deptno primary key(deptno);
    Table altered.
    SQL> select distinct deptno from emp_bkp;
        DEPTNO
            30
            20
            40
            10
    SQL> select deptno from dept_bkp;
        DEPTNO
            10
            20
            30
            40
            55
    SQL>  alter table emp_bkp
      2   add constraint fk_deptno_bkp foreign key(deptno)
      3    references dept_bkp(deptno);
    Table altered.
    SQL> alter table emp_bkp
      2  drop constraint fk_deptno_bkp;
    Table altered.
    SQL> insert into emp_bkp(empno,ename,deptno) values(142,'Fenny',90);
    1 row created.
    SQL> alter table emp_bkp
      2  add constraint fk_deptno_bkp foreign key(deptno)
      3   references dept_bkp(deptno);
    add constraint fk_deptno_bkp foreign key(deptno)
    ERROR at line 2:
    ORA-02298: cannot validate (SCOTT.FK_DEPTNO_BKP) - parent keys not found
    SQL> update emp_bkp
      2  set deptno=null
      3  where empno=142;
    1 row updated.
    SQL> alter table emp_bkp
      2  add constraint fk_deptno_bkp foreign key(deptno)
      3   references dept_bkp(deptno);
    Table altered.
    SQL> insert into dept_bkp (deptno,dname)values(90,'IT');
    1 row created.
    SQL> update emp_bkp
      2  set deptno=90
      3  where empno=142;
    1 row updated.Twinkle

Maybe you are looking for