Joining table reduce the significantly

We have a module that create need to load record from 3 tables to construct the object, if we query for 20k object, it take 20s object, which look longer than expected.
Thus we try to join that 3 tables and run single query to get the record. However that even more slow, it take 60s to get those objects.
One problem is one of the tables use varchar as ID, we need to join that table with to_char(other_id) = id . However, even that create performance penality, this should no be that slow....
Is this data look normal to you , will you think we have a lot of room to improve?

Can you please provide:
1. The ODBC settings for the datastore
2. The full schemas for each table, including indices
3. The exact SQL statements you are running (the single table query and the join)
4. The rowcounts for each table
5. Confirm if you updated optimiser statistics after populating the tables.
Thanks,
Chris

Similar Messages

  • Crosstab two joined tables multiplies the data in each column ....

    below is code that crosstabs monthy sales numbers and totals for each month.  So what I need to do is add a column that totals last years sales (table will be called [2013]) and add a column called 2013 YTD. I also need to add a calculation column that
    calculates growth from one year to another. So I join the 2013 table and add one last line that sums 2013 sales but i need only Jan-Mar at this point. in other words I just need to see the total sales for each dealer from 2013 Jan-Mar while still viewing Jan-Dec
    for the current year. So looking at the end product I need to see the Dealer Info, Jan, Feb, Mar, Apr......and at the end 2013 Sales and Growth. Thus, the Where clause. Unfortunately, each months sales are multiplied x 3 with or without the 2013 sum line.
    As soon as I join the tables the numbers get multiplied.
    What am I missing??????
    SELECT    
    substring([2014].Dealer,18,50)AS
    [Dealer Name],substring([2014].Dealer,9,1)AS
    [District],substring([2014].Dealer,11,6)AS
    [Dealer Code],
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 1 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Jan,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 2 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Feb,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 3 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Mar,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 4 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Apr,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 5 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS May,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 6 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Jun,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 7 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Jul,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 8 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Aug,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 9 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Sep,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 10 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Oct,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 11 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Nov,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 12 THEN
    [2014].[Sales Count]
    ELSE 0 END
    AS
    Dec,
    SUM([2014].[Sales Count])
    AS [2014 Total],
    FROM        
    dbo.[2014]
    GROUP
    BY substring([2014].Dealer,18,50),substring([2014].Dealer,9,1),substring([2014].Dealer,11,6)

    This needs to be moved to Transact-SQL forum. You may want to post DDL of your tables, some input data (as insert statements) and desired output.
    In the meantime I think you'll find this blog post helpful:
    Aggregates with multiple tables
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Conditions on Outer Joined Tables

    I'm trying to understand how Discoverer handles conditions created on outer joined tables. We're using Discoverer Plus 11.1.1.3.
    I have a query using two tables connected by an outer join. While I want all records back from the first table, I don't want all records back from the outer joined table. So, if I typed the SQL directly in a SQL Editor, I would put the '(+)' in each condition. However, I find that in Discoverer, sometimes it does this, and sometimes it doesn't. If it does not put the '(+)' on all conditions as well as the join, that essentially nullifies the outer join and makes it an standard join.
    For example, I expanded an item on the outer joined table in the Items dialog to see its list of values, and selected one, to add the column to the worksheet and create a condition. No (+). But when I deleted this and created the condition using the Condition dialog, I got a (+). Then I created another condition using the condition dialog. I used the IN operator and pasted in a list (this item had no item class to choose from)--no (+).
    When I tried manually adding (+) after the item name in the condition dialog, it put quotes around the whole thing and treated it as a string.
    I can find nothing in the documentation that discusses this. Is is possible to control whether or not it uses the (+)?
    Thank you, Scott Newman

    Dear Michael,
    Last night I had a call from user who was experiencing a very strange behaviour of her Discoverer workbook.
    I replicated the issue on my machine and could not believe my eyes. A condition on an item was being ignored. I then analysed the workbook and realised it was due to a condition on an item from an outer-joined folder. I did not have the strength after a long day to deal with it and was looking forward to having some fun the next day. Firstly, I tried few tricks such as NVL, LENGTH functions in a test query in Toad. I hate to give up but I did and searched threads on this forum and opened few. The very first thread I read was this one and I laughed when I read your advice. Only until the moment I tested it in the troubled workbook. It worked like a charm. I take my hat off to you Michael. I have rarely experienced such a satisfaction when solving a tricky problem during my 9-year-long Oracle Discoverer journey. This goes straight to my little text file with interesting problems and solutions.
    Thank you very much. I owe you a beer or two.
    It is great to have an expert like you, always ready to share his knowledge with his colleagues.
    P.S.
    My apologies for this massive post, I could not resist expressing my joy and gratitude.
    Jozef Hlavaty

  • Will Materialized view log reduces the performance of DML statements on the master table

    Hi all,
    I need to refresh a on demand fast refresh Materialized view in Oracle 11GR2. For this purpose I created a Materialized view log on the table (Non partitioned) in which records will be inserted @ rate of 5000/day as follows.
    CREATE MATERIALIZED VIEW LOG ON NOTES NOLOGGING WITH PRIMARY KEY INCLUDING NEW VALUES;
    This table already has 20L records and adding this Mview log will reduce the DML performance on the table ?
    Please guide me on this.

    Having the base table maintain a materialised view log will have an impact on the speed of DML statements - they are doing extra work, which will take extra time. A more sensible question would be to ask whether it will have a significant impact, to which the answer is almost certainly "no".
    5000 records inserted a day is nothing. Adding a view log to the heap really shouldn't cause any trouble at all - but ultimately only your own testing can establish that.

  • What is the better way to join table for ASE 12.5?

    To join table with T-SQL, there are 2 options:
    select * from tab1 a join tab2 b on a.id = b.id where x=y
    select * from tab1a, tab2 b where a.id = b.id and x=y
    this is only a syntax difference or there is a performance difference? which one is better for performance?

    The first query (using the join clause) is the ANSI standard way of writing joins and is usually supported by all mainstream RDBMSs.
    The second query is the T-SQL method of writing joins and may have limited re-usability with other RDBMSs.
    In most cases which one you use is usually one of preference, ie, which ever one you're comfortable with.
    From a technical perspective there are some join constructs that you cannot build with T-SQL joins, but can build with ANSI joins (eg, you may have problems in T-SQL with a table that you want to be both a) an inner table of an outer join and b) part of a equi/inner join).
    Soooo, ANSI joins provide you a lot more flexibility in coding as well as portability (between other RDBMSs).  But if you're going to work with ASE you'll still need to understand how T-SQL joins work as you'll see quite a lot of T-SQL join-based queries.

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • What are the Pros and Cons while joining tables at DF and Universe level

    Hi Experts,
    I am new to Data federator designer. I need help on the below.
    Could you please let me know the Pros and Cons while joining the source tables in data federator
    And While joining the DF target tables in universe designer.
    Regards,
    Gana

    Hi,
    1. I have created target tables based on source tables with one to one mapping and then join all target tables in universe.
    Ex: Source tables: Infocube text tables, fact tables and 3rd party data base table
    Target tables:Target tables are same as source tables
    --- Yes this is the way to create target Tables  and join them in the universe.These target Tables gives you the flexibility  like in future your requirement is to add one more object based on some calculation which is not possible in the universe so that time you can create  one more column in the target table and do the calculation. at the same time if you are using source table you can not do anything.
    2. Created single target table with all objects of source tables and merged all sources tables data.
    Ex: Source tables: Infocube text tables, fact tables and 3rd party data base table
    Target table: Single table.
    --- This is bit complex structure to merge all tables data in the one target table.in this situation you have to put more efforts and it is more complex.basically this type of target table is useful when you are merging data by multiple source into single  or  creating one target table based on the  union of tables by adding two mapping rules or more and you can not join tables in universe.
    Better approach is first 1. create target tables based on the source tables and join them in the universe.
    Thanks,
    Amit

  • Reducing the topics in default table of contents

    Hello- This one should be easy, but I can't figure it out.
    How do I reduce the number of topics in the default table of contents. For example, I want to get rid of all the level 2 subjects. For example:
    Summary 1
    Highlights 1
    Sub Highlights 1
    I'd like to get rid of the sub highlights... my table of contents is 2 pages for a 5 page document.
    Any thoughts?
    Thanks!

    Oh man... I'm an idiot... I found it.. was super easy in the TOC section. Didn't look in the document inspector sections...
    thx

  • How do I reducing the amount of joining when using one-to-one mappings?

    Examine the following example;
    class Person
    Address address;
    String firstName, lastName;
    class Address
    Long addressId;
    String state, city, zip;
    Assume that both of these classes are mapped to tables in a database. Attributes such as Staff's name and Address's addressId, state, city, and zip are direct-to-field mappings. Staff's address attribute is a one-to-one mapping.
    If you write the following expression:
    Expression exp = new ExpressionBuilder(Person.class).get("address").get("addressId").equal(4L);
    Toplink will create a query like the following:
    select first_name, last_name, address_id, ...
    from person t0, address t1
    where t0.address_id = t1.address_id
    and t1.address_id = 4;
    This is an unneccesary join because the person table already has the column with the data in it since it has a foriegn key. Is there someway to tell toplink to not join the tables when the only thing you are querying on is if a foriegn key that already exists in the referenced table? What I would want/expect to see is the following:
    select first_name, last_name, address_id, ...
    from person t0
    where t0.address_id = 4;
    I beleive we are using TopLink version 10.1.3.1

    In your initial query you're actually saying "find the Person who has an Address who's id is 4". Your second query is "find the Person who references an address who's id is 4". The first query requires there be an Address with ID 4, the other does not.
    If you define a query key "addressId" for the ADDRESS_ID column on the Person descriptor you can write this query as:
    Expression exp = new ExpressionBuilder(Person.class).get("addressId").equal(4L);This will result in the SQL you want.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • URGENT:Problem in a mapping with 8 tables in JOIN and using the DEDUP op.

    I have an urgent problem with a mapping: I must load data from 8 source tables (joined togheter) in a target table.
    Some data from 1 of the 8 tables have to be deduplicated, so I created a sort of staging table where I inserted the "cleaned" data, I mean, the deduplicated ones.
    I made it to make all the process faster.
    Then, I joined the 8 tabled, writing the join conditions in the operator properties, and connected the outputs into the fields of the target table.
    But..it does not work because this kind of mapping create a cartesian product.
    Then, I tried again with another mapping builted up in this way: after the joiner operator, I used the Match-Merge Operator and I load all data into a staging table exactly alike the target one, except for the PK (because it is a sequence). Then, I load the data from this staging table into the target one, and, of course, I connect to the target table also the sequence (the primary key). The first loading works fine (and load all the data as I expected).
    For the next loadings,I scheduled a pre-mapping process that truncate the staging table and re-load the new data.
    But..it does not work. I mean, It doesn't update the data previously loaded (or inser the new ones), but only insert the data, not considering the PK.
    So, my questions are as follow:
    1) Why loading the data directly from the joiner operator into the fact table doesn't work? Why does it generate a cartesian product??
    2) The "escamotage" to use the Match-Merge operator is correct? I have to admit that I didn't understand very well the behaviour of this operator...
    3) And, most of all, HOW CAN I LOAD MY DATA? I cannot find a way out....

    First of all, thanks for the answer!
    Yes, I inserted the proper join condition and in fact I saw that when WB generates the script it considers my join but, instead of using the fields in a single select statement, it builts up many sub-selects. Furthermore, it seems as it doesn't evaluate properly the fields coming from the source tables where I inserted the deduplicated data...I mean, the problems seems not to be the join condition, but the data not correctly deduplicated..

  • How to reduce the number of data blocks used by table

    Hi,
    I was trying to reduce the space usage of a particular table of my apex application which stores blob content and therefore deleted many records from it.
    However, the data block usage remained the same as before.
    I have tried to 'analyze' the table and validate the structure,but am unable to overcome this problem.
    Could someone throw some light on what needs to be to reduce the number of data blocks used by this table?
    Best Regards,
    Priya Jetley

    Priya:
    It is likely that the BLOB content defined in your table is being stored 'Out-of-Line'. This means that the LOB columns are stored in segments of their own. These then are the segments that may need shrinking.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#i1006363
    Varad

  • How do I join two tables in the same database and load the result into a destination table in a SSIS package

    Hi,
    I have a query that joins two tables in the same database, the result needs to be loaded in a destination DB table.  How do I do this in SSIS package?
    thank you !
    Thank You Warmest Fanny Pied

    Please take a look at these links related to your query.
    http://stackoverflow.com/questions/5145637/querying-data-by-joining-two-tables-in-two-database-on-different-servers
    http://stackoverflow.com/questions/7037228/joining-two-tables-together-in-one-database

  • Adding one more table to the select statement joining 4 tables gives dump

    Hi All,
    There is a select statement using which four tables namely VBAK,VBAP,LIPS and LIKPUK(view) are joined(inner join).Here, date and time fields are selected from LIPS and used.
    My requirement is to consider the Date (LIKP - WADAT_IST) instead of LIPS-ERDAT  and time(LIKP-SPE_WAUHR_IST) is to be used instead of LIPS-erzet.
    Neither LIPS nor LIKPUK contains time(SPE_WAUHR_IST) field. And, I cannot remove LIPS table or LIKPUK view as each contains a unique field which is used in the report.
    When I tried to join LIPS in the select query, it is going to dump.
    Can someone suggest a good approach ?
    Thanks,
    Pavan

    Thank you for the detailed explanation of the dump.
    The dump details together with your code lead to the answer: 42.
    Regards,
    Clemens

  • Urgent HELP - How to reduce the number of entries in table MESYBODY?

    Does anyone know how to reduce the number of records in synchronization table MESYBODY and MESYHEAD?  The reason I wanted to reduce these tables is because I believe they have so many duplicated entries that causes extremely slow performance everytime we sync.  Currently, there are almost 50,000 records for approximately 100 users, and I believe it shouldn't be that much. 
    We are running into a problem that it takes approximately 25-30 minutes to sync. 
    Any advices would be highly appreciated.
    Regards,
    Dai

    Hi Dai,
    please try to run the middleware job WAF_MW_MAPPING. For some applications (Mobile Time and Travel for example) this helps to clean the tables.
    Br, alex
    alexander ilg
    http://www.msc-mobile.com

  • How to reduce the size of System tables(RS*) in SAP BW?

    Hi All,
    We need to reduce the size of a system tables(RS*) in SAP BW system without impacting anything to system.
    Could you please let us know is there any Global program/Function module to do the same.
    If not if you know any individual program or other way to reduce the system table size it will be very much useful.
    Sample System tables(RS*) are given below.
    RSHIENODETMP
    RSBERRORLOG
    RSHIENODETMP~0
    RSBMNODES
    RSBKDATA
    RSBMNODES~001
    RSRWBSTORE
    RSBMLOGPAR
    RSBERRORLOG~0

    Sudhakar,
    There are tables you can archive / clean up and then there are tables you cannot do anything about. For example - if your system has a million queries - the RSRREPDIR , RZCOMPDIR tables will be large.
    The tables that typically get archived are :
    1. BALDAT / BALHDR - application log tables
    2. Monitor tables - search for Request archiving which will tell you how to archive the same
    The other tables -
    First you would have to understand why they are large in the first place ... if you have too many hierarchies - then some tables can be huge - delete some of the hierarchies you do not need and the table sizes should come down.
    RSRWBSTORE - this is the internal store for workbooks - this will have the last executed version of the workbook stored in the table. This information is called when the workbook is executed without refreshing the variables - which is why you get the workbook output first and then get prompted to refresh the variables.

Maybe you are looking for

  • Generics - re-writed version

    Hello all. I am building a small app that requires a persistence manager to save objects in an xml repository file. I am trying to use generics to see if I can avoid casting objects from a general super class to concrete class. Lets say Entity and Pe

  • My iCalendar (MacBook Pro) is frozen

    My iCalendar (MacBook Pro) is frozen along with a portion of something I copied to paste on the calendar. I cannot delete. I performed a Force Quit and Restarted, to no avail. My iphone calendar works fine.

  • Out of order library

    I'm running itunes 5.0.1., and yesterday i finally got around upgrading to tiger. anyway, today when i'm trying to play music out of library folder - the songs are playing in a random order. in other words - i do a search function for say "abbey road

  • Form Runtime

    Hi, What is the best way to connect to the database schema automatively when the form is in run time. Example: When you close the form builder or run the form in form runtime, it always prompts you for the database schema. What is the best way to sol

  • Document status values

    Hello! I am on solar02 transaction and pulling out IMG objects for configuration. After configuring I am documenting the config in the  by pulling object-document . The default status values for this in "processing status"column are - open, in proces