Issue with performance tuning of a query

Hi,
I have a query which is in the below format
select a.* from
(inline query) a,
(inline query b)
where a.id = b.id;
Now i want the inline query b to be executed first and then joined with a.
How can i achieve the same.
Let me know if more information is required.

h4. NO_MERGE - This will allow inline query executing first
h4. LEADING(b) and USE_NL(b a) - We want to make driving table as "b" and then nest loop with "a"
SELECT /*+ LEADING(b) USE_NL(b a) */ a.*
FROM   (SELECT /*+ NO_MERGE */ LEVEL ID FROM dual CONNECT BY LEVEL <= 100 ) a,
       (SELECT /*+ NO_MERGE */ LEVEL ID FROM dual CONNECT BY LEVEL <= 10  ) b
WHERE  a.id = b.id;
| Id  | Operation                      | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT               |      |     1 |    26 |     4   (0)| 00:00:01 |
|   1 |  NESTED LOOPS                  |      |     1 |    26 |     4   (0)| 00:00:01 |
|   2 |   VIEW                         |      |     1 |    13 |     2   (0)| 00:00:01 |
|*  3 |    CONNECT BY WITHOUT FILTERING|      |       |       |            |          |
|   4 |     FAST DUAL                  |      |     1 |       |     2   (0)| 00:00:01 |
|*  5 |   VIEW                         |      |     1 |    13 |     2   (0)| 00:00:01 |
|*  6 |    CONNECT BY WITHOUT FILTERING|      |       |       |            |          |
|   7 |     FAST DUAL                  |      |     1 |       |     2   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   3 - filter(LEVEL<=10)
   5 - filter("A"."ID"="B"."ID")
   6 - filter(LEVEL<=100)
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Issues with performance and RAM previews

    Just did a major system upgrade from an iMac to a Mac Pro, and now I'm having an issue with performance...specifically with RAM previews.
    When I try to do a RAM preview with audio, it grinds my entire OS to a hault (can't switch apps, or click on much of anything). It eventually clears up enough for me to stop the RAM preview.
    So, I'm wondering if maybe my Memory & Multiprocessing settings might be off.
    Here are my system specs:
    Mac Pro
    2 x 2.4GHz 6-Core Intel Xeon (12 cores)
    64GB RAM
    ATI Radeon HD 5870
    AE CS6 (11.0.2.11)
    AE is installed on an SSD drive and the scratch disk is an internal HDD.
    Here are my AE Memory Settings:
    Here's my GPU Info:
    Let me know if any other info is needed...   

    You are reserving far too little RAM for other software.
    See this: "Performance tip: Don't starve your software of RAM."
    (Also, I recommend going through all of these materials: http://forums.adobe.com/thread/543440 )
    Regarding the SSD: Putting your application files on it means that applications load/boot faster. This is fine, but that benefit is just when you first start the application. If you put your cache files on it, then you get the benefit every time that something is read from or written to the cache---i.e., many times per second, for the entire time that you're working. Put your cache files on your SSD. BTW, there's no reason to not put your application files and caches on the same SSD. The reason that you split things across multiple disks is to prevent simultaneous reads and writes to and from a slow disk; the program loading from disk happens at a different time than reading and writing cache files, so there is no potential for conflict and slowdown.

  • Is anyone else having an issue with performance in Mavericks?

    My computer is brand new. Just bought it a week ago. Since I installed Mavericks, I have been having very big issues with performance. It now takes forever to start up, it loads programs extremely slowly, and it randomly freezes for a few minutes at a time. Is anyone else having these issues? I have already re-installed the OS. What else can I do?

    Mavericks has certainly made up for all the problem-free updates I've had in the past! I have significant system drag (endless spinning beachballs....), Safari is incredibly slow, Mail - gmail & icloud - almost unusable. I'm desperately hoping the first OS update fixes things.

  • Issue with compounding characteristics in the query

    Hello guyz
    I have an issue with 2 chars one compounding the other in the query. The 2 chars are : Action Type and Action Reason in HR. Action type is the compounding char. for action reason.
    For example: we have
    Action Type    Action Reason
    01                        A1
    01                        A2
    02                        A1         
    02                        A2
    Now I want to restrict a key figure based on specific action reasons and types. But when I pick AT: 01, AR: A1, it selects AT: 02, AR: A1. The reason why it does this is because, there are 2 A1s under action reason and it picks the one at the end (ie last record with value A1 in the table)
    But my compounding works when i create variables for the same and have them as user entry variables.
    My question: How do i pick specific action reasons for specific action types (for restricting key figures) in the above example?
    Thanks.

    Well.. thank you Ashish for your help so far.
    Now, these Chars. are coming directly from a data source to the cube. From my previous example again, the thing that i dont understand is:
    When i try restrict the KF with AR, on the left hand side of the pop up window i see:
           AR
    [01, A1] --> Very good
    [01, A2] --> Good
    [02, A3[ --> OK
    [02, A4] --> Bad
    [02, A1] --> Very Bad
    But, when i drag 'A1' (Very Good)  to restrict on the KF on the right hand side of the window, I only get:
    A1 (Very good), what i want to drag is [01, A1] --> very good.. action type value should come along with action reason.. right??
    when i save the query, logout and log back in, I see:
    A1 (Very Bad)
    Question: Why dosen't Action type char come along with action reason on the right hand side.. its a compounding char right?? So it should determine what value action reason takes?
    Any idea??

  • Issue with Performance Point Filters and SSRS when visibility is toggled

    I have a SSRS report that has the visibility toggled with the (+/-) sign. The report is SQL Server 2008 R2 / SharePoint Integrated in a SharePoint 2010 Site. The reports datasource is an Analysis Services database.
    I am displaying the report in a Performance Point Dashboard and am connecting it to Performance Point filters using the member unique name. The report filters correctly when the dashboard filters change. However, when I click to expand a plus sign to toggle
    the visibility, the report goes back to it's default filters of '[Dimension].[All]' and all data is returned, and the visibility is not expanded.
    I have confirmed that the report visibility toggling works in BIDS and via the report that is stored in SharePoint. I have also confirmed that it works when the report is stored in the native mode report server, and integrated with Performance
    Point in the same manner.
    So, I 'think' I have whittled the problem down to be the combination of SharePoint Integrated and Performance Point.
    Anyone have any ideas?
    Jewels

    Hi,
    I am having a similar issue with PerformancePoint SSRS and visibility togle. Were you able to figure this out?
    I have a report which calls a sub report. When I click on the report it passes parameters to sub report which works fine. But as soon as I click the visibility toggle, it goes back to default. Strange thing is that it works in PerformancePoint as a 
    stand alone report (sub report alone in PP). Just when it is a sub report and parameters are passed through url this issue happens.
    Any suggestions are welcome. I have spent hours trying to figure this one out.

  • Issues with simple cron job to query database

    Hi all,
    This is really a mix, of both a database issue and a Linux issue, so I thought I'd post it here to get the most visibility. I have been looking into this, and also had a couple other DBA's at my company help, and we are not able to figure it out, so I thought I'd post it here. Basically, I have a simple shell script that is just doing a sqlplus connection to the database and querying V$INSTANCE. When I run the script from the command line, it runs fine, but for the life of me, I can't get it to run from the crontab.
    I'm running Oracle 10.1.0.3.0 on a RedHat ES Linux release 3 (Red Hat Enterprise Linux AS release 3 (Taroon Update 5) server. This is all local on the server - the database is on this server, and this is also where I'm running the script.
    I've made the script as simple as possible, like this:
    #!/bin/sh
    sqlplus / as sysdba <<EOF
    Select * from v\$instance;
    EOF
    When I run this script from the command line, it is running fine. But then I put it in a crontab entry like this:
    00 * * * * /home/oracle/scripts/cron_test.sh > /home/oracle/scripts/cron_test.log 2>&1
    And I am seeing this in the logfile:
    Connected to an idle instance.
    SQL> SQL> Select * from v$instance
    ERROR at line 1:
    ORA-01034: ORACLE not available
    SQL> SQL> Disconnected
    At first glance, it seems like a simple issue with environment variables not being set properly, but I have tested this to exhaustion. I've put in all of the environment variables into the shell script to duplicate what I have on the command line, but it still won't work. I've checked on just about anything else I could think of - looked at the tnsnames and listener config, looked at the profile from the crontab in /etc/profile, nothing works...
    And on any other server that I test this on, it all works fine and as expected. So I'm trying to figure out why I'm only having this issue on this one particular server?? Some kind of server config or setting that could be causing it?
    I appreciate any comments or tips!!
    Thanks,
    Brad

    Done. Here is the output from the command line:
    AGENT_HOME=/u01/app/oracle/product/10.2.0/agent10g
    _=/bin/env
    G_BROKEN_FILENAMES=1
    HISTSIZE=1000
    HOME=/home/oracle
    HOSTNAME=rlldb.celgene.com
    INPUTRC=/etc/inputrc
    JAVA_HOME=/usr/java/j2re1.4.2_08/
    LANG=en_US.UTF-8
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    LL_ALL=en_US
    LOGNAME=oracle
    LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
    MAIL=/var/spool/mail/oracle
    MANPATH=:/opt/IBM/director/man
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/10.1.0/Db_1
    ORACLE_SID=rlldb
    PATH=/u01/app/oracle/product/10.1.0/Db_1/bin:/usr/java/j2re1.4.2_08//bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/IBM/director/bin:/home/oracle/bin:/sbin://u01/app/oracle/product/10.1.0/Db_1/OPatch:/u01/app/oracle/dbvisit/dbvisit:/u01/app/oracle/product/10.1.0/Db_1/bin
    PWD=/home/oracle/scripts
    SHELL=/bin/bash
    SHLVL=2
    SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
    SSH_CLIENT=10.20.241.84 2988 22
    SSH_CONNECTION=10.20.241.84 2988 10.20.1.29 22
    SSH_TTY=/dev/pts/4
    TERM=xterm
    USER=oracle
    And the output from the cron run:
    HOME=/home/oracle
    LOGNAME=oracle
    ORACLE_HOME=/u01/app/oracle/product/10.1.0/Db_1
    ORACLE_SID=rlldb
    PATH=/usr/bin:/bin:/u01/app/oracle/product/10.1.0/Db_1/bin
    PWD=/home/oracle
    SHELL=/bin/sh
    SHLVL=2
    _=/usr/bin/env
    And the diff of the 2:
    1,4d0
    < AGENT_HOME=/u01/app/oracle/product/10.2.0/agent10g
    < _=/bin/env
    < G_BROKEN_FILENAMES=1
    < HISTSIZE=1000
    6,11d1
    < HOSTNAME=rlldb.celgene.com
    < INPUTRC=/etc/inputrc
    < JAVA_HOME=/usr/java/j2re1.4.2_08/
    < LANG=en_US.UTF-8
    < LESSOPEN=|/usr/bin/lesspipe.sh %s
    < LL_ALL=en_US
    13,16d2
    < LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
    < MAIL=/var/spool/mail/oracle
    < MANPATH=:/opt/IBM/director/man
    < ORACLE_BASE=/u01/app/oracle
    19,21c5,7
    < PATH=/u01/app/oracle/product/10.1.0/Db_1/bin:/usr/java/j2re1.4.2_08//bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/IBM/director/bin:/home/oracle/bin:/sbin://u01/app/oracle/product/10.1.0/Db_1/OPatch:/u01/app/oracle/dbvisit/dbvisit:/u01/app/oracle/product/10.1.0/Db_1/bin
    < PWD=/home/oracle/scripts
    < SHELL=/bin/bash
    PATH=/usr/bin:/bin:/u01/app/oracle/product/10.1.0/Db_1/bin
    PWD=/home/oracle
    SHELL=/bin/sh23,28c9
    < SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
    < SSH_CLIENT=10.20.241.84 2988 22
    < SSH_CONNECTION=10.20.241.84 2988 10.20.1.29 22
    < SSH_TTY=/dev/pts/4
    < TERM=xterm
    < USER=oracle
    _=/usr/bin/env-----
    I've even gone to the extreme, of taking every single environment variable from my command line environment, and putting all of them into the shell script. but still no luck... I've also contacted my Linux SysAdmins, to see if they have any thoughts/input on this.

  • Analysis and Performance tuning of a query

    Hi gurus,
    We have few reports built on multiprovider (which is containing five basic cubes) whose response time is very slow, so i want to do some analysis to find out why they are runing very slow and also do the performance tuning.
    So where do i start and how do i start like is it from Report or multiprovider
    if its report or multiprovider please kindly guide me what are the things do i need to look for and how to correct them whether adding something or changing the data design.
    i have four reports
    1. is runing on three basic cubes
    2. is runing on all the five cubes
    3.& 4.  runing on 2 cubes
    so kindly give your inputs
    thanks and regards
    Neel

    docs on performance available in
    FAQ - The Future of SAP NetWeaver Business Intelligence in the Light of the NetWeaver BI&Business Objects Roadmap
    https://service.sap.com/bi
    -> performance
    effective query on MP can be found
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b03b7f4c-c270-2910-a8b8-91e0f6d77096
    for nw2004s
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a9ab011a-0e01-0010-02a1-d496b94c9c0f
    modeling on multiprovider
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2f5aa43f-0c01-0010-a990-9641d3d4eef7
    hope this helps.

  • Performance tuning of sql query with multiple joins

    My query takes at least half an hour to execute and the number of records returned are approx 1 lakh records.
    Structure of tables are:
    tblSession : ID,option1,option2,option3,option4,option5,option6,option7,option8,option9.
    tblOption : ID, labelID
    tblLabelDetail  : ID, LABELID, text
    optionID 1 to optionID9 are Foreign keys to table tblOption.ID
    My query is as below : 
    select 
    session.ID 
    ,session.tstamp
    ,session.score
    ,session.hid1
    ,session.hID2
    ,session.hID3
    ,session.collectionID
    ,session.consumerID
    ,session.langID
    ,cons_cust.text1 as    customCons_text1, 
    cons_cust.text2 as customCons_text2, 
    cons_cust.text3 as customCons_text3,
    cons_cust.text4 as customCons_text4,
    cons_cust.text5 as customCons_text5,
    cons_cust.text6 as customCons_text6,
    cons_cust.text7 as customCons_text7,
    cons_cust.text8 as customCons_text8,
    cons_cust.text9 as customCons_text9,
    ld_cons1.text as customCons_option1GUID, 
    ld_cons2.text as customCons_option2GUID, 
    ld_cons3.text as customCons_option3GUID, 
    ld_cons4.text as customCons_option4GUID ,
    ld_cons5.text as customCons_option5GUID, 
    ld_cons6.text as customCons_option6GUID, 
    ld_cons7.text as customCons_option7GUID, 
    ld_cons8.text as customCons_option8GUID, 
    ld_cons9.text as customCons_option9GUID,
    --session
    session_cust.text1 as  session_cust_text1, 
    session_cust.text2 as session_cust_text2, 
    session_cust.text3 as session_cust_text3,
    session_cust.text4 as session_cust_text4,
    session_cust.text5 as session_cust_text5,
    session_cust.text6 as session_cust_text6,
    session_cust.text7 as session_cust_text7,
    session_cust.text8 as session_cust_text8,
    session_cust.text9 as session_cust_text9,
    ld_sess1.text as session_cust_option1GUID, 
    ld_sess2.text as session_cust_option2GUID, 
    ld_sess3.text as session_cust_option3GUID, 
    ld_sess4.text as session_cust_option4GUID, 
    ld_sess5.text as session_cust_option5GUID, 
    ld_sess6.text as session_cust_option6GUID, 
    ld_sess7.text as session_cust_option7GUID, 
    ld_sess8.text as session_cust_option8GUID, 
    ld_sess9.text as session_cust_option9GUID, 
    session_cust.tStamp1,
    session_cust.tStamp2
    from mvSession session with (noexpand)
    inner join tblCollection c on c.ID=session.collectionID AND c.templateID = 405
    left join tblConsumer cons on cons.ID=session.consumerID and cons.sessionYM between 601 and 1412 and cons.sID=105
    left join vCustomConsumer cons_cust on cons_cust.sessionYM between 601 and 1412 and cons_cust.sID=105 and cons_cust.ID=cons.ID
    left join tbloption o_cons1 on o_cons1.id = cons_cust.option1 and  o_cons1.sid = 105
    left join tblLabelDetail ld_cons1 on ld_cons1.labelID = o_cons1.labelID and ld_cons1.langId = 1 and ld_cons1.eid = 107 
    left join tbloption o_cons2 on o_cons2.id = cons_cust.option2 and  o_cons2.sid = 105
    left join tblLabelDetail ld_cons2 on ld_cons2.labelID = o_cons2.labelID and ld_cons2.langId = 1 and ld_cons2.eid = 107 
    left join tbloption o_cons3 on o_cons3.id = cons_cust.option3 and  o_cons3.sid = 105
    left join tblLabelDetail ld_cons3 on ld_cons3.labelID = o_cons1.labelID and ld_cons3.langId = 1 and ld_cons3.eid = 107 
    left join tbloption o_cons4 on o_cons4.id = cons_cust.option4 and  o_cons4.sid = 105
    left join tblLabelDetail ld_cons4 on ld_cons4.labelID = o_cons4.labelID and ld_cons4.langId = 1 and ld_cons4.eid = 107 
    left join tbloption o_cons5 on o_cons5.id = cons_cust.option5 and  o_cons5.sid = 105
    left join tblLabelDetail ld_cons5 on ld_cons5.labelID = o_cons5.labelID and ld_cons5.langId = 1 and ld_cons5.eid = 107 
    left join tbloption o_cons6 on o_cons6.id = cons_cust.option6 and  o_cons6.sid = 105
    left join tblLabelDetail ld_cons6 on ld_cons6.labelID = o_cons6.labelID and ld_cons6.langId = 1 and ld_cons6.eid = 107 
    left join tbloption o_cons7 on o_cons7.id = cons_cust.option7 and  o_cons7.sid = 105
    left join tblLabelDetail ld_cons7 on ld_cons7.labelID = o_cons7.labelID and ld_cons7.langId = 1 and ld_cons7.eid = 107 
    left join tbloption o_cons8 on o_cons8.id = cons_cust.option8 and  o_cons8.sid = 105
    left join tblLabelDetail ld_cons8 on ld_cons8.labelID = o_cons8.labelID and ld_cons8.langId = 1 and ld_cons8.eid = 107 
    left join tbloption o_cons9 on o_cons9.id = cons_cust.option9 and  o_cons9.sid = 105
    left join tblLabelDetail ld_cons9 on ld_cons9.labelID = o_cons9.labelID and ld_cons9.langId = 1 and ld_cons9.eid = 107 
    left join vCustomSession session_cust on session_cust.sessionYM between 601 and 1412 and session_cust.sID=105 and session_cust.ID=session.ID
    left join tbloption o_sess1 on o_sess1.id = session_cust.option1 and  o_sess1.sid = 105
    left join tblLabelDetail ld_sess1 on ld_sess1.labelID = o_sess1.labelID and ld_sess1.langId = 1 and ld_sess1.eid = 107 
    left join tbloption o_sess2 on o_sess2.id = session_cust.option2 and  o_sess2.sid = 105
    left join tblLabelDetail ld_sess2 on ld_sess2.labelID = o_sess2.labelID and ld_sess2.langId = 1 and ld_sess2.eid = 107 
    left join tbloption o_sess3 on o_sess2.id = session_cust.option3 and  o_sess3.sid = 105
    left join tblLabelDetail ld_sess3 on ld_sess3.labelID = o_sess2.labelID and ld_sess3.langId = 1 and ld_sess3.eid = 107 
    left join tbloption o_sess4 on o_sess4.id = session_cust.option4 and  o_sess4.sid = 105
    left join tblLabelDetail ld_sess4 on ld_sess4.labelID = o_sess4.labelID and ld_sess4.langId = 1 and ld_sess4.eid = 107 
    left join tbloption o_sess5 on o_sess5.id = session_cust.option5 and  o_sess5.sid = 105
    left join tblLabelDetail ld_sess5 on ld_sess5.labelID = o_sess5.labelID and ld_sess5.langId = 1 and ld_sess5.eid = 107 
    left join tbloption o_sess6 on o_sess6.id = session_cust.option6 and  o_sess6.sid = 105
    left join tblLabelDetail ld_sess6 on ld_sess6.labelID = o_sess6.labelID and ld_sess6.langId = 1 and ld_sess6.eid = 107 
    left join tbloption o_sess7 on o_sess7.id = session_cust.option7 and  o_sess7.sid = 105
    left join tblLabelDetail ld_sess7 on ld_sess7.labelID = o_sess7.labelID and ld_sess7.langId = 1 and ld_sess7.eid = 107 
    left join tbloption o_sess8 on o_sess8.id = session_cust.option8 and  o_sess8.sid = 105
    left join tblLabelDetail ld_sess8 on ld_sess8.labelID = o_sess8.labelID and ld_sess8.langId = 1 and ld_sess8.eid = 107 
    left join tbloption o_sess9 on o_sess9.id = session_cust.option9 and  o_sess9.sid = 105
    left join tblLabelDetail ld_sess9 on ld_sess9.labelID = o_sess9.labelID and ld_sess9.langId = 1 and ld_sess9.eid = 107 
    where session.sID=105  and session.tStamp >= 'Sep  1 2014 12:00AM' and session.tStamp < 'Dec 12 2014 12:00AM'   
    order by session.tStamp, session.ID
    Is there a way , where i can simplify the joins with tbloption and tblLabelDetail and get my o/p in optimal time.
    Regards 

    I have headed towards another approach ie. using unpivot and then pivot.
    First i am converting option1-option9 into column , then doing  PIVOT to get back the same record . But issue is that when i am doing pivoting i am getting NULL values.
    My query is :
    select * into #t1  from
    select ID
    , option1
    , option2
    , option3
    , option4
    , option5
    , option6
    , option7
    , option8
    , option9
    from vCustomConsumer
    where sid=105
    and sessionYM = 1412 
    ) SourceTable
    UNPIVOT
       optionID FOR Col IN
        (option1 
    ,option2
    ,option3 
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9 )
    ) AS unpvt
    select t.ID,t.optionID,t.col,cast(ld.text as varchar(max)) as text into #t2
    from #t1 t
    left outer join tbloption o on o.ID =  t.optionID
    left outer join tblLabelDetail ld on ld.labelID = o.labelID and ld.langID=1 
    order by ID,col
    select ID,option1 
    ,option2
    ,[option3]
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9
    from
    select ID,optionID,col,text
    from #t2
    )up
    pivot 
    min(text)for col in 
    (option1 
    ,option2
    ,[option3]
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9
    )as pvt
    In my last query where i am using pivot, i am getting NULL values. When i check the data in temp table #t2 , it exists perfectly . But when pivoting i dont understand why it is returning most of the NULL values. I am getting data for only one column in single
    row.
    Below are some rows from result set finally obtained after pivoting :
    ID
    option1
    option2
    option3
    option4
    option5
    option6
    option7
    option8
    option9
    62949026
    NULL
    0 to 200 seconds
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    62966000
    NULL
    NULL
    4
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    62966032
    NULL
    NULL
    4
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    63090372
    NULL
    NULL
    NULL
    NULL
    EN
    NULL
    NULL
    NULL
    NULL
    63090375
    NULL
    NULL
    NULL
    NULL
    EN
    NULL
    NULL
    NULL
    NULL
    Thanks,

  • Performance tuning for ABAP Query (created from t-cd SQ01)

    Hello all,
    We created ABAP Query report from transaction SQ01.
    But the generated report has an appropriate SQL statement which causes performance problem.
    To solve this issue, I guess the easiest way is;
    0. Give up to use it.
    1. Copy it to another object in the customer namespace.
    2. Ajust SQL statement.
    But I'm wondering if there're appropriate ways to adjust SQL statement of Query.
    Could anybody give me any better idea?
    Thank you
    Yuko

    You can try this: Create 2 ranges, for objnr and cdtcode and fill like:
    ra_objnr-sign = 'I'.
    ra_objnr-option = 'CP'.
    ra_objnr-low = 'OR*'.
    append ra_objnr.
    ra_code-sign = 'I'.
    ra_code-option = 'CP'.
    ra_code-low = 'CO*'.
    append ra_code.
    SELECT objnr udate utime
    FROM jcds
    INTO TABLE it_jcds
    WHERE objnr IN ra_objnr
    AND stat = l_tj02t
    AND cdtcode IN ra_code
    AND inact = space
    Regards,
    John.

  • Performance tuning for JCDS query

    Hi All,
    I have a performance issue in following query.Any Idea how can it be improved?
        SELECT objnr udate utime
               FROM jcds
               INTO TABLE it_jcds
               WHERE objnr LIKE c_or
                AND   stat = l_tj02t
                AND   cdtcode LIKE c_co
                AND  inact = space.
    Fields          Distinct values
    CDTCODE                  111
    INACT             192
    Only one index i.e Primary Index
    UNIQUE     Index   JCDS~0 (Compute)
    Column Name                     #Distinct
    MANDT                                          3
    OBJNR                                  2.165.245
    STAT                                         100
    CHGNR                                        319
    Is 'like' statement causing the performance issue and how can it be corrected?
    Or Index can be created for this?

    You can try this: Create 2 ranges, for objnr and cdtcode and fill like:
    ra_objnr-sign = 'I'.
    ra_objnr-option = 'CP'.
    ra_objnr-low = 'OR*'.
    append ra_objnr.
    ra_code-sign = 'I'.
    ra_code-option = 'CP'.
    ra_code-low = 'CO*'.
    append ra_code.
    SELECT objnr udate utime
    FROM jcds
    INTO TABLE it_jcds
    WHERE objnr IN ra_objnr
    AND stat = l_tj02t
    AND cdtcode IN ra_code
    AND inact = space
    Regards,
    John.

  • Issue with webi report on BEx query

    Hi,
    I have created a universe on top of Bex query.  There is no issue in creating and exporting the universe.  But when I try to create a webi report out that BEx query, I am not able to see the values.  Say if I have a column called "Company"  I am getting the value as "All Company" and so on.  What will be the issue?
    But when a report is generated out of BEx analyser they are able to see the values properly.
    Same user credentials are used in both the places (Importing the query into universe, Connecting to BEx Analyser) .
    Thanks & Regards,
    Subbu S

    Hi Subbu,
    the universe will generate a L00 item and a L01 item. The L00 item shows the All member of the characteristic in the case of a flat list and the Top level nodes from a hierarchy. the L01 item should give you what you looking for.
    Ingo

  • Performance tuning in SQL query using join of views

    Hi,
    Am trying to tune a query of the format
    select ........ from view1,view2
    where view1.keyfield = view2.keyfield
    The base tables of the views view1 and view2 have indexes specified on 'keyfield'.
    However, when I do an explain plan of the query, Full table scan of those base tables are performed.
    Even tried using Hints in this query to force Oracle to use those indexes, but still not successful.
    Any pointers on how to tune this kind of query would be highly welcome.
    Regards,
    Baish

    If your query is really of the same form as you posted, then full table scans then a hash or merge join may be the most efficient plan.
    You are asking for all of the rows from view1 and the matching rows from view2, because of this, Oracle dedcided that the cost of full table scans using multi-block reads is cheaper than using single block reads to get the rowids from the index, then single block reads to get the rows from the table.
    FULL SCAN <> BAD
    John

  • Issue with calculating Top 20 % in Query Designer

    Hai
    I am working on Query designer 7.0 where I need to design a report which has 4 parts. The first 3 parts displays the Items with Top 20 Inventory Value with 3 respective divisions for 6 months . Now the 4th part is to display Top 20% of inventory Value.
    So in this report I need to take the Total Inventory and calculate the Top20 % of the items. Hence in this report I need to refer to the top 20 value of 3 divisions. So I cant jus give one condition. So I tried the replacement path for Items with restriction to other queries and created the variables. But I cant use these varaibles in the structures of rows or columns. It gives an error that this variable cant be used in Structure.
    Please do help me in refering the top 20 values of 3 divisions for 6 months and do a calculation to display the % in my 4th report.
    I will assign points for any kind of help provided

    If you can design all those in One query than you can have it...
    It seems now your aim is just to take result for 3 queries and use it in 4th query...
    But if you can figure out defining all 3 Divisions and restriction in Same Query and then put the DISPLAY OPTION = HIDE = do not display
    and then use their result to display you will achieve what you want to....
    for e.g.
    Jan 07-----Feb 07 -
    Mar 07 -
    Dec 07
    Division 1-- Item 1 -
    Inv 1 -
    Inv1.........................DO NOT DISPLAY
    Item2 -
    Inv2 -
    Inv2..........................DO NOT DISPLAY
    Item3 -
    Inv3 -
    Inv3..........................DO NOT DISPLAY
    <i><b>----
    Item20 -
    Inv20 -
    Inv20</b></i>........................DISPLAY ONLY
    Division 2-- Item 1 -
    Inv 1 -
    Inv1......................DO NOT DISPLAY
    Item2 -
    Inv2 -
    Inv2........................DO NOT DISPLAY
    Item3 -
    Inv3 -
    Inv3........................DO NOT DISPLAY
    <b><i>----
    Item20 -
    Inv20 -
    Inv20</i></b>....................DISPLAY ONLY
    Division 3-- Item 1 -
    Inv 1 -
    Inv1</b>.......................DO NOT DISPLAY
    Item2 -
    Inv2 -
    Inv2.......................DO NOT DISPLAY
    Item3 -
    Inv3 -
    Inv3.......................DO NOT DISPLAY
    <i><b>----
    Item20 -
    Inv20 -
    Inv20</b></i>.........DISPLAY ONLY
    THEN you will have result
    Division -
    Jan07 -
    Feb 07 -
    Marc 07
    div1 -
    Total inv/sum(top20) -
    Total inv/sum(top20) -
    Total inv/sum(top20)
    div2 -
    Total inv/sum(top20) -
    Total inv/sum(top20) -
    Total inv/sum(top20)
    div3 -
    Total inv/sum(top20) -
    Total inv/sum(top20) -
    Total inv/sum(top20)

  • Issue with dynamic selection in SAP Query

    Hi,
    I have a doubt in SAP QUERY
    i used that for creating Customer Master Report
    2 fields i have added in dynamic selection from knvv table. if i try to excute based on the value in that 2 fields
    i'm not getting  output records based on that
    pls help me with the logic from where i can get the variables for that dynamic fileds.
    thanks in advancde.

    Hi Suhas,
    Actually in my report user will enter program name & variant name, based on this I need to find out the value for that variant & print that report. so for normal selection I can get the detail using FM: "RS_VARIANT_CONTENTS" but for dynamic selection (Free selection), I am not getting the detail using this FM.
    So I need any FM or Table Name which gives me the value for dynamic selection based on the report & variant.
    Thanks & Regards,
    Lalit Soni

  • Issue with performance

    Hi all,
    can anyone tell me whats the issue
    types : begin of t_TABLE.
            include structure zTABLE.
    types : TABLE like mara-matnr.
    types: end of t_table.
    data: i_table type standard table of t_table.
    data: wa_table like line of i_table.
    types : begin of t_table1.
            include structure zTABLE1.
    types : TABLE like mara-matnr.
    types: end of t_table1.
    data: i_table1 type standard table of t_table1.
    data: wa_table1 like line of i_table1.
    select * from zTABLE into table i_ztable where werks  = 'ABC'.
    select * from zTABLE1 into table i_ztable1 where werks  = 'ABC'.
    1) LOOP AT I_Ztable INTO WA_Ztable1.
    READ TABLE I_Ztable1 WITH KEY -
    IF SY-SUBRC EQ 0.
    DELETE TABLE i_ztable FROM wa_zTABLE.
    WA_ZTABLE-TABLE = 'TABLE'.
    insert wa_zTABLE into table i_zTABLE.
    ENDIF.
    ENDLOOP.
    2) LOOP AT I_ZTABLE INTO WA_ZTABLE.
    READ TABLE I_ZTABLE1 WITH KEY -
    IF SY-SUBRC EQ 0.
    WA_ZTABLE-TABLE = 'TABLE'.
    modify i_zTABLE from wa_zTABLE transporting TABLE
                    where zNO = wa_zTABLE-zNO.
    ENDIF.
    ENDLOOP.
    3)
    data: i_final type standard table of t_table.
    data: wa_final like line of i_table.
    LOOP AT I_ZTABLE INTO WA_ZTABLE.
    READ TABLE I_ZTABLE1 WITH KEY -
    IF SY-SUBRC EQ 0.
    WA_ZTABLE-TABLE = 'TABLE'.
    insert wa_zTABLE into table i_zFINAL.
    ENDIF.
    ENDLOOP.
    The first and second ar very slow it's taking minutes and the 3 takes just a sec or two
    let me know if iam missed anything
    Thanks

    > 3)
    > data: i_final type standard table of t_table.
    > data: wa_final like line of i_table.
    >
    >  LOOP AT I_ZTABLE INTO WA_ZTABLE.
    >
    > READ TABLE I_ZTABLE1 WITH KEY -
    > IF SY-SUBRC EQ 0.
    >
    >
    > WA_ZTABLE-TABLE = 'TABLE'.
    >  insert wa_zTABLE into table i_zFINAL.
    >
    >
    > ENDIF.
    > ENDLOOP.
    >
    >
    Your 3 options are not functionally equivalent.
    IF sy-subrc is not 0 for any entry, then the table in option 3 will not contain all entries from the original table.
    This is not the case with the first 2 options.
    This can be fixed with a trivial change, however.
      DATA: i_final TYPE STANDARD TABLE OF t_table.
      DATA: wa_final LIKE LINE OF i_table.
      LOOP AT i_ztable INTO wa_ztable.
        READ TABLE i_ztable1 WITH KEY -----.
        IF sy-subrc EQ 0.
          wa_ztable-table = 'TABLE'.
        ENDIF.
        INSERT wa_ztable INTO TABLE i_zfinal.  " insert outside of IF ensures that full table is in final table
      ENDLOOP.
    The third option is fastest because the size of the table starts out small, and each insert takes very little processing time.   The repeated inserts, deletes and modifies in the other versions require more processing, since the table alread has entries.
    If you correct the logic flaw in optoin 3, it is a useful way to go, but the previous poster's suggestion to use a field symbol may be best.
    The point of my post is that you are not necessarily comparing apples to apples, since your option 3 is flawed.
    Good luck

Maybe you are looking for

  • Itunes dosen t recognize my ipad

    when i connect my ipad 2 to itunes a popup says This cannot be used because the apple mobile device is not started                                   what i can do

  • 11G SQL pivot example?

    Hello, Can anyone help me write a SQL pivot statement using 11G to do the following?: Table columns ========= Deliverable Phase (For simplicity we'll make the total possible Phase values equal 1 to 13) Delv_IN_Phase_Y_N Char(3) values 'Yes' or 'No' I

  • Internal Error 2330. 1392...(plug_ins\PaperCapture)

    My Acrobat file folder is corrupted. I can't uninstall, install new, or even open the folder. It causes the message: Internal Error 2330. 1392, Program Files\Adobe\Acrobat 7.0\Acrobat\plug_ins\PaperCapture I have Windows Vista and customer support wo

  • Microsoft Office when using OS X 10.7 or higher??

    Are there any apps that work well so I can work from home using Microsoft office from my work?

  • Sharing Adobe Document Services Instance

    Hello Our organization has multiple SAP System Landscapes. I would like to know if ADS can be shared with multiple SAP Systems. Please advise if there are any Pros and Cons with sharing ADS. Thanks Jay