Joining two queries causes big performance hit

There are two queries: one with a sub query and one without
although they both return the same data, one uses a full table scan of the indexed 'trade_index' table
and thus is much slower
any Ideas why it does this?:
SQL> select count(*) from trade_index ti, counterparty_xref cx
2 where ti.CPY_SID = cx.CPY_SID and ti.TRADE_OR_ARCHIVE = 'A'
3 and cx.XREF_VALUE in (select ml.VALUE from v_mis_lists ml where ml.LIST_NAME = 'Deutsche Bank DB')
4 and cx.XREF_TYPE = 'Client RXM'
5 and ti.START_DATE < to_date('01/01/2004','DD/MM/YYYY')
6 and (ti.END_DATE >= to_date('01/01/2003','DD/MM/YYYY') or ti.END_DATE = '01-Jan-1900') ;
COUNT(*)
6195
Elapsed: 00:00:15.08
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2572 Card=1 Bytes=57)
1 0 SORT (AGGREGATE)
2 1 HASH JOIN (Cost=2572 Card=26581 Bytes=1515117)
3 2 HASH JOIN (Cost=460 Card=5619 Bytes=219141)
4 3 VIEW OF 'VW_NSO_1' (Cost=8 Card=16 Bytes=272)
5 4 SORT (UNIQUE) (Cost=8 Card=16 Bytes=960)
6 5 HASH JOIN (Cost=4 Card=16 Bytes=960)
7 6 TABLE ACCESS (BY INDEX ROWID) OF 'MIS_LISTS' (Cost=1 Card=2 Bytes=60)
8 7 INDEX (RANGE SCAN) OF 'MISL_NAT_UK' (UNIQUE) (Cost=2 Card=2)
9 6 TABLE ACCESS (FULL) OF 'MIS_LIST_VALUES' (Cost=2 Card=817 Bytes=24510)
10 3 TABLE ACCESS (FULL) OF 'COUNTERPARTY_XREF' (Cost=451 Card=35116 Bytes=772552)
11 2 TABLE ACCESS (FULL) OF 'TRADE_INDEX' (Cost=2056 Card=286928 Bytes=5164704)
SQL> select ml.VALUE from v_mis_lists ml where ml.LIST_NAME = 'Deutsche Bank DB';
VALUE
B49540
B60010
Elapsed: 00:00:00.00
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 NESTED LOOPS
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'MIS_LISTS'
3 2 INDEX (RANGE SCAN) OF 'MISL_NAT_UK' (UNIQUE)
4 1 INDEX (RANGE SCAN) OF 'MISLV_PK' (UNIQUE)
SQL> select count(*) from trade_index ti, counterparty_xref cx
2 where ti.CPY_SID = cx.CPY_SID and ti.TRADE_OR_ARCHIVE = 'A'
3 and cx.XREF_VALUE in ('B49540','B60010')
4 and cx.XREF_TYPE = 'Client RXM'
5 and ti.START_DATE < to_date('01/01/2004','DD/MM/YYYY')
6 and (ti.END_DATE >= to_date('01/01/2003','DD/MM/YYYY') or ti.END_DATE = '01-Jan-1900') ;
COUNT(*)
6195
Elapsed: 00:00:02.06
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=532 Card=1 Bytes=40)
1 0 SORT (AGGREGATE)
2 1 NESTED LOOPS (Cost=532 Card=41 Bytes=1640)
3 2 TABLE ACCESS (FULL) OF 'COUNTERPARTY_XREF' (Cost=451 Card=1 Bytes=22)
4 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRADE_INDEX' (Cost=81 Card=286928 Bytes=5164704)
5 4 INDEX (RANGE SCAN) OF 'CPY_SID_IDX' (NON-UNIQUE) (Cost=2 Card=286928)
What I dont understand is that:
cx.XREF_VALUE in (select ml.VALUE from v_mis_lists ml where ml.LIST_NAME = 'Deutsche Bank DB')
and
cx.XREF_VALUE in ('B49540','B60010')
are essentially the same thing
(ie the subquery returns the values I have used)
but the optimizer uses a totally different (slower) method to execute the rest of the former query?
Many thanks
Ian

Hi,
Here is with join and not using the view: still have full table scan of large table trade_index
SQL> select count(*) from mis_lists ml, mis_list_values mlv, counterparty_xref cx, trade_index ti
2 where ti.CPY_SID = cx.CPY_SID and ti.TRADE_OR_ARCHIVE = 'A'
3 and cx.XREF_VALUE = mlv.VALUE
4 and mlv.MISL_SID = ml.MISL_SID
5 and ml.LIST_NAME = 'Deutsche Bank DB'
6 and cx.XREF_TYPE = 'Client RXM'
7 and ti.START_DATE < to_date('01/01/2004','DD/MM/YYYY')
8 and (ti.END_DATE >= to_date('01/01/2003','DD/MM/YYYY') or ti.END_DATE = '01-Jan-1900') ;
COUNT(*)
6195
Elapsed: 00:00:12.08
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2602 Card=1 Bytes=10
0)
1 0 SORT (AGGREGATE)
2 1 HASH JOIN (Cost=2602 Card=26581 Bytes=2658100)
3 2 HASH JOIN (Cost=456 Card=5619 Bytes=460758)
4 3 HASH JOIN (Cost=4 Card=16 Bytes=960)
5 4 TABLE ACCESS (BY INDEX ROWID) OF 'MIS_LISTS' (Cost1 Card=2 Bytes=60)
6 5 INDEX (RANGE SCAN) OF 'MISL_NAT_UK' (UNIQUE) (Cost=2 Card=2)
7 4 TABLE ACCESS (FULL) OF 'MIS_LIST_VALUES' (Cost=2 Card=817 Bytes=24510)
8 3 TABLE ACCESS (FULL) OF 'COUNTERPARTY_XREF' (Cost=451Card=35116 Bytes=772552)
9 2 TABLE ACCESS (FULL) OF 'TRADE_INDEX' (Cost=2056 Card=286928 Bytes=5164704)
Statistics
0 recursive calls
47 db block gets
16519 consistent gets
4981 physical reads
0 redo size
205 bytes sent via SQL*Net to client
622 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
Thanks for you help,
Ian

Similar Messages

  • Enable lastlogin timestamp cause big performance hit

    We have installed the ODSEE 11g in our environment and we want to enable the lastlogin timestamp but base on the slamd testing result, the performance got hit almost 50% for user authentication. Is this normal? I created SR with oracle and was told it is normal. is anybody using this function as well? if so any tricks or workaround to increase the perfromance?
    Thanks

    It's basically adding an update for every BIND operation. If the lastlogin attribute is indexed, there is even more write load. The tuning you can do should start with the kind of tuning you'd do for a high volume of updates to the Directory. You should instrument the host, paying particular attention to iostat data like service times on disks and how much CPU time is spent in IOWait.

  • Join two queries

    I'm tryinng to join two queries that I made in sqlplus:
    the first one is:
    select dname,sum(hours) as proj_hrs
    from IBL.works_on w ,IBL.project p,IBL.department d
    where w.pno=p.pnumber
    and p.dnum=d.dnumber
    group by dname;
    that output:
    DNAME PROJ_HRS
    Administration 115
    Headquarters 25
    Research 155
    the second one is:
    select dname,sum(hours) as emp_hrs
    from IBL.works_on w,IBL.employee e,IBL.department d
    where e.dno=d.dnumber
    and w.essn=e.ssn
    group by dname;
    that output
    DNAME EMP_HRS
    Administration 115
    Headquarters
    Research 180
    I'm trying to join both of them to get:
    DNAME PROJ_HRS EMP_HRS
    Administration 115 115
    Headquarters 25
    Research 155 180
    Can anybody help me please

    If I understood you correctly, have you tried this? I did not try this, just think that it will work.
    select a.dname, a.proj_hrs, b.emp_hrs from
    select dname,sum(hours) as proj_hrs
    from IBL.works_on w ,IBL.project p,IBL.department d
    where w.pno=p.pnumber
    and p.dnum=d.dnumber
    group by dname
    ) a,
    select dname,sum(hours) as emp_hrs
    from IBL.works_on w,IBL.employee e,IBL.department d
    where e.dno=d.dnumber
    and w.essn=e.ssn
    group by dname
    ) b
    where a.dname = b.dname
    You can use the NVL function to print out something special for the null values.

  • Joining two queries with Visual Composer

    Hallo,
    I was working with visual composer to join two queries with the distinct operator. But on my table view, when i linked it with the distinct operator, i get only the key element customer (customer, customer_ext_key, customer_key). These are the queries that i want join:
    Query 1:
    Customer
    Net Sales
    Query 2:
    Customer
    Billed Quantity
    What i want to see is the following result:
    Customer
    Net Sales
    Billed Quantity
    Can anybody help me with this problem?
    Greeting,
    Murat.

    Hallo,
    I was working with visual composer to join two queries with the distinct operator. But on my table view, when i linked it with the distinct operator, i get only the key element customer (customer, customer_ext_key, customer_key). These are the queries that i want join:
    Query 1:
    Customer
    Net Sales
    Query 2:
    Customer
    Billed Quantity
    What i want to see is the following result:
    Customer
    Net Sales
    Billed Quantity
    Can anybody help me with this problem?
    Greeting,
    Murat.

  • How to join two queries

    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    _1st query_
    select
    (CASE WHEN SUBSTR(R1.RA_NO,1,3)= 'NRA' THEN 'Damansara Uptown One Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'ORA' THEN 'Damansara Uptown Two Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'VRA' THEN 'Damansara Uptown Realty Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'URA' THEN 'Uptown Elite Sdn. Bhd.'
    when SUBSTR(R1.RA_NO,1,3)= 'WRZ' THEN 'U5 Management Corporation Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,2)= 'FR' THEN 'See Hoy Chan Facilities Management Sdn.Bhd.' END) Landlord
    ,TO_CHAR(C1.COLL_DTE,'RRRRMM') MONTH1
    ,SUM(C2.TRN_AMT) UPTO_31
    , SUM(CASE WHEN to_char(C1.COLL_dte) BETWEEN to_date(:P_FROM_DATE,'dd.mm.yyyy') AND '16-'||to_date(:P_TO_DATE,'dd.mm.yyyy') THEN C2.TRN_AMT END) UPTO_15
    from ra1 R1, COLLECT1 C1 , COLLECT2 C2
    where
    (to_char(C1.COLL_dte) between to_date(:P_FROM_DATE,'dd.mm.yyyy') AND to_date(:P_TO_DATE,'dd.mm.yyyy'))
    and (SUBSTR(R1.RA_NO,1,2)= 'FR' or SUBSTR(R1.RA_NO,1,3) in ('NRA' ,'ORA','VRA','URA','WRZ'))
    AND R1.RA_NO = C2.INV_NO
    AND C2.COLL_NO = C1.COLL_NO
    GROUP BY
    (CASE WHEN SUBSTR(R1.RA_NO,1,3)= 'NRA' THEN 'Damansara Uptown One Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'ORA' THEN 'Damansara Uptown Two Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'VRA' THEN 'Damansara Uptown Realty Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'URA' THEN 'Uptown Elite Sdn. Bhd.'
    when SUBSTR(R1.RA_NO,1,3)= 'WRZ' THEN 'U5 Management Corporation Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,2)= 'FR' THEN 'See Hoy Chan Facilities Management Sdn.Bhd.' END)
    ,TO_CHAR(C1.COLL_DTE,'RRRRMM')
    _2query_
    select sum(decode(substr(ra_no,1,7),'NRA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) NRA
    ,sum(decode(substr(ra_no,1,7),'VRA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) VRA
    ,sum(decode(substr(ra_no,1,7),'ORA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) ORA
    ,sum(decode(substr(ra_no,1,7),'FR'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) FR
    ,sum(decode(substr(ra_no,1,7),'WRZ'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) WRZ
    ,sum(decode(substr(ra_no,1,7),'URA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) URA
    from RA1
    above are the two queries i need to join these two queries by naming the second query column name as total .

    1st query output  is ----------
    LOCATION                                                                 MONTH1    UPTO_31           UPTO_15        
    U5 Management Corporation Sdn. Bhd.                           201001     15250                8900                                 
    Uptown Elite Sdn. Bhd.                                                201001      3000                 1500                                 
    See Hoy Chan Facilities Management Sdn.Bhd.                 201001      917115.45         584876.5                            
    Damansara Uptown Two Sdn. Bhd.                                201001      757277.45         495362.95                          
    Damansara Uptown One Sdn. Bhd.                                 201001     881558.65          404872.45                          
    Damansara Uptown Realty Sdn. Bhd.                              201001      321675.8           150508.6                              
    2nd query output is -------
    NRA              ORA              VRA              URA              WRZ           FR
    2323.31        95945           34367.8        34267            4343         343
    Now what i need is
    LOCATION                                                                 MONTH1    UPTO_31           UPTO_15          TOTAL
    U5 Management Corporation Sdn. Bhd.                           201001     15250                8900                2323.31                 
    Uptown Elite Sdn. Bhd.                                                201001      3000                 1500                95945                  
    See Hoy Chan Facilities Management Sdn.Bhd.                 201001      917115.45         584876.5           34367.8                  
    Damansara Uptown Two Sdn. Bhd.                                201001      757277.45         495362.95          34267                 
    Damansara Uptown One Sdn. Bhd.                                 201001     881558.65          404872.45           4343
    Damansara Uptown Realty Sdn. Bhd.                              201001      321675.8           150508.6           343above is the clear picture what i need , i don't know how to do it please help me
    Edited by: user9093689 on Feb 21, 2010 8:06 PM

  • Need to join two queries A/R statemet and Activity report

    I have two  separate queries that need to be one. I have an A/R statement where I want to add notes next to each invoice. Currently these are two separate reports. How can I link the activity Report to the A/R Statement. Below are the two separate reports. I am not sure how to join the files. A/R Aging Report Declare @d datetime set @d /*Select 1 from jdt1 t where t.duedate*/=[%1] select * from ( SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number',     CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'           WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'     ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,@d)=0 and DateDiff(day, T0.DueDate,@d)30 and DateDiff(day, T0.DueDate,@d)60 and DateDiff(day, T0.DueDate,@d)90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days' FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode WHERE  T1.CardType = 'C' ) sub Activity Report SELECT T1.[ClgCode],T2.[U_NAME], T4.[Name] as Status, T0.[CardCode], T0.[CardName], T0.[DocNum], T0.[U_AIS_DVIInvName] as 'SF Invoice Name', (T0.U_AIS_DVISFSO) as 'SO#', T0.[DocDate],T0.Taxdate as 'Month Of Service',T0.[U_AIS_DVIOpptyNm],T0.[U_AIS_DVIAdvNm],T0.[U_AIS_DVIManNm],T0.[U_AIS_DVIAcctNm], T0.[DocTotal], T0.[DocStatus],  T1.[Recontact],  T1.[Details], T1.[Notes], T1.[CntctType], T3.[Name] FROM OINV T0 left join OCLG T1 on t0.docentry = t1.docentry and  T0.[ObjType]  =  T1.[DocType] left outer JOIN OUSR T2 ON T1.UserSign = T2.USERID left outer join OCLT T3 ON T1.CntctType = T3.Code left outer join OCLS T4 ON  T1.CntctSbjct = T4.Code where T1.[CntctType] =6 or T1.[CntctType] =7

    This is what I have so far.. it finally produced results but I notice the amount on the Activity + Aging does not match what is on the Aging and that seems to be what the issue is... that was my check to know the report is working. Basically the report should show the aging + any activity associated with the open invoice. The amount on the report is lower than the aging.. I am attaching the aging query  and the aging with activity Query. It looks like something is not joining correctly as the amounts do not match on the balance. Aging Report Declare @d datetime set @d /*Select 1 from jdt1 t where t.duedate*/=[%1] select * from ( SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number',     CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'           WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'     ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,@d)=0 and DateDiff(day, T0.DueDate,@d)30 and DateDiff(day, T0.DueDate,@d)60 and DateDiff(day, T0.DueDate,@d)90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days' FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode WHERE  T1.CardType = 'C' ) sub Activity + Aging Declare @d datetime set @d /*Select 1 from jdt1 t where t.duedate*/=[%1] select * from ( SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number',     CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'           WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'     ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,@d)=0 and DateDiff(day, T0.DueDate,@d)30 and DateDiff(day, T0.DueDate,@d)60 and DateDiff(day, T0.DueDate,@d)90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days', T6.[FirstName] as 'AP Contact First Name', T6.[LastName] as 'AP Contact Last Name' , T6.[E_MailL], T6.[Notes1] as ' AP Supervisor', T2.[ClgCode],T7.[U_NAME], T4.[Name] as Status, T5.[DocNum], T5.[U_AIS_DVIInvName] as 'SF Invoice Name', (T5.U_AIS_DVISFSO) as 'SO#', T5.[DocDate],T5.Taxdate as 'Month Of Service',T5.[U_AIS_DVIOpptyNm],T5.[U_AIS_DVIAdvNm],T5.[U_AIS_DVIManNm],T5.[U_AIS_DVIAcctNm], T5.[DocTotal], T5.[DocStatus],  T2.[Recontact],  T2.[Details], T2.[Notes], T2.[CntctType], T3.[Name] FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode INNER JOIN OCLG T2 ON T1.CardCode = T2.CardCode INNER JOIN OCLT T3 ON T2.CntctType = T3.Code INNER JOIN OCLS T4 ON T2.CntctSbjct = T4.Code INNER JOIN OINV T5 ON t5.docentry = t2.docentry and  T5.[ObjType]  =  T2.[DocType] left outer join OCPR T6 ON T2.CntctCode = T6.CntctCode left outer JOIN OUSR T7 ON T2.UserSign = T7.USERID WHERE  T1.CardType = 'C' and (T2.[CntctType] =6 or T2.[CntctType] =7) ) sub

  • Just upgraded - and took a big performance hit

    As prompted, I upgraded Safari and Leopard just an hour ago, and my computer has been lagging ever since. My word processor (Mellel) labors over every letter, web sites groan to display themselves, and even typing this brief message is a chore.
    Is this just me?

    Is this just me?
    Yes, it's just you. Unfortunately, it's hard to say what it may take to get you back to normal. These sorts of things happen when you upgrade over an already corrupted system. Since you didn't provide any information on exactly what you did, how you did it, in what order, or over what system level I can only stab at possible solutions.
    First, try the following:
    Repairing the Hard Drive and Permissions
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Installer menu (Utilities menu for Tiger and Leopard.) After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list. In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer. Now shutdown the computer for a couple of minutes and then restart normally.
    If DU reports errors it cannot fix, then you will need Disk Warrior (4.0 for Tiger, and 4.1 for Leopard) and/or TechTool Pro (4.6.1 for Leopard) to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    Afterwards I would suggest downloading the standalone Safari 3.1 upgrade and the Leopard Combo upgrade from Apple's Download Site. Reinstall the upgrades. Be sure when you do the upgrades that no other applications are running and that you do not use the computer in any way until the upgrades are completed.
    Second, do some maintenance:
    Kappy's Personal Suggestions for OS X Maintenance
    For disk repairs use Disk Utility. For situations DU cannot handle the best third-party utilities are: Disk Warrior; DW only fixes problems with the disk directory, but most disk problems are caused by directory corruption; Disk Warrior 4.0 is now Intel Mac compatible. TechTool Pro provides additional repair options including file repair and recovery, system diagnostics, and disk defragmentation. TechTool Pro 4.6.1 is Leopard compatible; Drive Genius is similar to TechTool Pro in terms of the various repair services provided. The current version, 1.5.1, is Intel Mac compatible.
    OS X performs certain maintenance functions that are scheduled to occur on a daily, weekly, or monthly period. The maintenance scripts run in the early AM only if the computer is turned on 24/7 (no sleep.) If this isn't the case, then an excellent solution is to download and install a shareware utility such as Macaroni, JAW PseudoAnacron, or Anacron that will automate the maintenance activity regardless of whether the computer is turned off or asleep.
    OS X automatically defrags files less than 20 MBs in size, so unless you have a disk full of very large files there's little need for defragmenting the hard drive. As for virus protection there are few if any such animals affecting OS X. You can protect the computer easily using the freeware Open Source virus protection software ClamXAV. Personally I would avoid most commercial anti-virus software because of their potential for causing problems.
    I would also recommend downloading the shareware utility TinkerTool System that you can use for periodic maintenance such as removing old logfiles and archives, clearing caches, etc.
    For emergency repairs install the freeware utility Applejack. If you cannot start up in OS X, you may be able to start in single-user mode from which you can run Applejack to do a whole set of repair and maintenance routines from the commandline. Note that presently AppleJack is not compatible with Leopard.
    When you install any new system software or updates be sure to repair the hard drive and permissions beforehand. I also recommend booting into safe mode before doing system software updates.
    Get an external Firewire drive at least equal in size to the internal hard drive and make (and maintain) a bootable clone/backup. You can make a bootable clone using the Restore option of Disk Utility. You can also make and maintain clones with good backup software. My personal recommendations are (order is not significant):
    1. Retrospect Desktop (Commercial - not yet universal binary)
    2. Synchronize! Pro X (Commercial)
    3. Synk (Backup, Standard, or Pro)
    4. Deja Vu (Shareware)
    5. PsynchX 2.1.1 and RsyncX 2.1 (Freeware)
    6. Carbon Copy Cloner (Freeware - 3.0 is a Universal Binary)
    7. SuperDuper! (Commercial)
    8. Data Backup (Commercial)
    The following utilities can also be used for backup, but cannot create bootable clones:
    1. Backup (requires a .Mac account with Apple both to get the software and to use it.)
    2. Toast
    3. Impression
    4. arRSync
    Apple's Backup is a full backup tool capable of also backing up across multiple media such as CD/DVD. However, it cannot create bootable backups. It is primarily an "archiving" utility as are the other two.
    Impression and Toast are disk image based backups, only. Particularly useful if you need to backup to CD/DVD across multiple media.
    Visit The XLab FAQs and read the FAQs on maintenance, optimization, virus protection, and backup and restore.
    Additional suggestions will be found in Mac Maintenance Quick Assist.
    Referenced software can be found at www.versiontracker.com and www.macupdate.com.
    Third, try updating pre-binding:
    1. Open the Terminal application in your Utilities folder.
    2. At the prompt enter or paste the following command:
    sudo update_prebinding -root / -force
    Press RETURN. You will be prompted for your password which will not be echoed. Wait until the prompt reappears then quit the Terminal and restart your computer.

  • Help with joining two queries

    Hi
    We recently inherited a database and we are re-wrting some queries. The first is
    SELECT gu.GEOGRAPHIC_UNIT_ID, gu.GEOGRAPHIC_UNIT_DESC, aggDataC.DATA as Capacity, aggDataP.DATA as Production
    FROM GEOGRAPHIC_UNIT_RELATIONSHIP gur, GEOGRAPHIC_UNIT
    gu, AGGREGATED_DATA aggDataC, AGGREGATED_DATA aggDataP
    WHERE      gur.PARENT_GEOGRAPHIC_UNIT_ID = :geographicUnitId AND gur.CHILD_GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND aggDataC.GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND ((:CommodityGroupId IS NULL AND
    aggDataC.COMMODITY_GROUP_ID IS NULL) OR (:CommodityGroupId = aggDataC.COMMODITY_GROUP_ID))
    AND ((:CommodityTypeId IS NULL AND
    aggDataC.COMMODITY_TYPE_ID IS NULL) OR (:CommodityTypeId = aggDataC.COMMODITY_TYPE_ID))
    AND ((:PlantTypeId IS NULL AND aggDataC.PLANT_TYPE_ID
    IS NULL) OR (:PlantTypeId = aggDataC.PLANT_TYPE_ID))
    AND aggDataC.ORGANISATION_ID is NULL
    AND aggDataC.YEAR = :Year
    AND aggDataC.STAT_TYPE_ID = (SELECT stat_type_id FROM
    stat_type WHERE stat_type = 'CAP')
    AND aggDataC.STAT_PERIOD_TYPE_ID = :StatPeriodTypeId
    AND aggDataP.GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND ((:CommodityGroupId IS NULL AND
    aggDataP.COMMODITY_GROUP_ID IS NULL) OR (:CommodityGroupId = aggDataP.COMMODITY_GROUP_ID))
    AND ((:CommodityTypeId IS NULL AND
    aggDataP.COMMODITY_TYPE_ID IS NULL) OR (:CommodityTypeId = aggDataP.COMMODITY_TYPE_ID))
    AND ((:PlantTypeId IS NULL AND aggDataP.PLANT_TYPE_ID
    IS NULL) OR (:PlantTypeId = aggDataP.PLANT_TYPE_ID))
    AND aggDataP.ORGANISATION_ID is NULL
    AND aggDataP.YEAR = :Year
    AND aggDataP.STAT_TYPE_ID = (SELECT stat_type_id FROM
    stat_type WHERE stat_type = 'PRD')
    The above query returns only the geographic units that have capacity and production figures.
    I want to return all other regions that have a plantypeid regardless of whether they have capacity and production data.
    I tried to use outer joins but this has not worked. The database is an oracledatabase
    the below query returns all the geographic regions I need
    SELECT gu.GEOGRAPHIC_UNIT_ID, gu.GEOGRAPHIC_UNIT_DESC
    FROM GEOGRAPHIC_UNIT_RELATIONSHIP gur, GEOGRAPHIC_UNIT gu
    where
    gur.PARENT_GEOGRAPHIC_UNIT_ID = :geographicUnitId
    AND gur.CHILD_GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    ANy idea how I merge the 2 queries?

    UNION

  • Joining two queries

    hi every one...
    i have to prepare report in the following way
    srno asset_code asset_group asset_cost
    here asset code and asset group i have to pick from flex field valueset...fr this the query is
    SELECT FLEX_VALUE asset_code, DESCRIPTION asset_group
    FROM FND_FLEX_VALUES_VL ffvh
    WHERE ffvh.flex_value_set_id =
    (select FLEX_VALUE_SET_ID from fnd_flex_value_sets
    where FLEX_VALUE_SET_NAME = 'XXEAM_ACCOUNT_CODE_KFF')
    AND ENABLED_FLAG = 'Y'
    AND SUMMARY_FLAG = 'Y'
    here the each asset_code has their child values and asset cost to that child value..
    so i have to calculate that total asset cost for total child values of each parent(asset_code)...
    for this the query is
    SELECT sum(asset_cost) asset_cost
    FROM csi_item_instances cii,
    xxeam_depreciation_master xdm
    WHERE cii.serial_number = xdm.serial_number
    AND cii.attribute3 IN (
    SELECT ffvh.flex_value
    FROM fnd_flex_values_vl ffvh
    WHERE ffvh.flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name =
    'XXEAM_ACCOUNT_CODE_KFF')
    AND enabled_flag = 'Y'
    AND summary_flag = 'N'
    AND ffvh.flex_value IN (
    SELECT child_flex_value_low
    FROM fnd_flex_value_norm_hierarchy ffvnh
    WHERE ffvnh.range_attribute = 'C'
    AND ffvnh.flex_value_set_id =
    ffvh.flex_value_set_id
    AND ffvnh.parent_flex_value ='10.100'))
    here instead of mentioning ffvnh.parent_flex_value ='10.100'
    i have to find for all parent values..
    so im not able to find this and im not able to make joins..
    so any one plz help me...
    thanks in advance..

    More or less a stab in the dark, but it sounds like you should cross join the groups and date tables with each other:
    SELECT DATEADD(MONTH,- 1, A.Date_Date)AS Report_Date, GROUP_NAME
                 SELECT COUNT(B.Ticket_ID)AS Active_Ticket_Count
                 FROM [HPSM].[dbo].[HPSM_Assignments] B
                 WHERE   B.Assignment_Scope= 'Group'
                    AND  B.Assigned_Timestamp< A.Date_Date
                    AND  B.Resolved_Timestamp> A.Date_Date   
                    AND  B.Group_Name= G.Assigned_To
          ) AS Active_Count
     FROM [ITSReporting ].[dbo].[REF_Date]A      
     CROSS JOIN [HPSM].[dbo].[HPSM_Groups] G
     WHERE Date_Is_Month_Start= 1
          AND A.Date_Date>= dateadd(ms,- 3,dateadd(mm,- 12,dateadd(mm,datediff(mm,0,getdate()),0)))
          AND A.Date_Date< dateadd(ms,- 3,dateadd(mm,1,dateadd(mm,datediff(mm,0,getdate()),0)))
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Where clause in COUNT function and joining two queries

    I have a table that I am trying to count the number of course passed, and also list the modules passed as well.
    the first problem I am having is what to put in the where variable , so that its not specific to a customer(I can use the query below for a particular customer and a particular course)but I will like a generic query where the result will be distinct in terms
    of user and course like the one below
    select FirstName,LastName,CourseTitle,Noofmodules, count (Coursecompleted) as modulescompleted from EStudentsprogress where Coursecompleted = '1'and EmailAddress = '[email protected]'
    and CourseTitle = 'Microsoft MOS 2010 EXCEL' Group by FirstName, LastName, CourseTitle, Noofmodules ;
    How can i make it list the result as above, whereby i dont specify the email address or course title(trying to get the result for all the clients )
    . Also I have a query that list the courses that is passed by the customer, I will like the column with the list of courses passed be added to the result above, but as a column for each course.
    select FirstName,LastName,CourseTitle, EmailAddress, CourseModule as coursepassed from EStudentsprogress where coursecompleted =1
    cheers

    Do you mean this?
    select FirstName,
    LastName,
    CourseTitle,
    Noofmodules,
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ',' + CourseTitle
    FROM EStudentsprogress
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    WHERE Coursecompleted = '1'
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName, CourseTitle, Noofmodules ;
    If not please provide some sample data and explain the output you want
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    I AM HAVING Incorrect syntax near the keyword 'WHERE'. 
    It was a typo
    try this
    select FirstName,
    LastName,
    CourseTitle,
    Noofmodules,
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ',' + CourseTitle
    FROM EStudentsprogress
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    AND Coursecompleted = '1'
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName, CourseTitle, Noofmodules ;
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    its populating all the result for a particular customer, so i added another clause to  it and it worked
    select FirstName,
    LastName,
    CourseTitle,
    Noofmodules, 
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ','  + CourseTitle
    FROM EStudentsprogress 
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    AND Coursecompleted = '1'
    AND CourseTitle = e.CourseTitle
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName, CourseTitle, Noofmodules ;
    but the result of the column is long , so i tried to used the course module, which is a column with numbers, and i tried modifying the query , but i had Error converting data type varchar to float.( i checked and saw that stuff is for concatinating
    strings) is there a way around it.
    i used 
    select FirstName,
    LastName,
    CourseModule,
    CourseTitle,
    Noofmodules, 
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ','  + CourseModule
    FROM EStudentsprogress 
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    AND Coursecompleted = '1'
    AND CourseTitle = e.CourseTitle
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName,CourseModule, CourseTitle, Noofmodules ;

  • How to join these two queries

    Hi experts,
    I need to join two queries but not sure how:
    select id from test_table1;
    select *
      from table(f_function(null
                           ,null
                           ,1 -- the id
                           ,sysdate);One query has IDs needed to run the second query. Is there a way to join those two?
    The result should be all columns from test_table1 + all columns from f_function.
    Best regards,
    Igor
    Edited by: Igor S. on Mar 8, 2013 5:18 AM

    Hi,
    Igor S. wrote:
    select  *
    from  test_table1,
    table(
    f_function(
    null,
    null,
    id,
    sysdate
    select  *
    from  test_table1,
    table(
    f_function(
    null,
    null,
    id,
    sysdate
    ) xyz
    where test_table1.id = xyz.id
    /So these two queries are the same?Try it and see.
    You'll find that the 2nd one produces an error. But if you change it to
    select  *
      from  test_table1,
            table(
                  f_function(
                             null,
                             null,
                             id,
                             sysdate
                            )      -- No alias here
                 ) xyz             -- Alias here, instead
    where test_table1.id = xyz.id
    /Then, assuming f_function produces a column called id, it will work.
    Whether it produces the same results or not depends on what the function returns, and whether either id is NULL.
    If the id column that the function returns is the same as the id value that you pass to it, and is never NULL, then the 2 queries will produce the same results.
    Either way, each row of test_table1 will be joined to each row that the function produces with the argument(s) from that row. The column names produced by the function and the values in those columns are determined by the function; they do not need to have anything in common with any table. In practice, a function like f_function will usually not return an column that is always identical to any of its inputs, since that value is already available from the input.

  • How can I join to queries?

    Hello all,
    I would like to ask if there is a way to join two queries into another new one.
    I've been trying including two structures from two queries (always from the same infoprovider) but the result is not what I'm looking for.
    Has anyone any idea of how to do this?
    Thank you very much,
    Carlos Hinestrosa

    Hi Michael,
    Thanks for your answer. I know there are lots of funtionalities in excel but I need the result of the query as simple as it is to work with it in SEM Balanced Scorecard / Management Cockpit because SEM does not support many BEX funtionalities.
    I make some calculations in one query and others in the other query, and I need the result of thoese calculations to make further calculations in a new query.
    I was trying to create a query but the dialog box only allows to create a query from a cube.
    Thanks,
    Carlos Hinestrosa

  • Join of queries

    Hello All
    Can someone tell me how to join two queries without using a multicube
    or infoprovider option.
    First Query has x, y, z fields
    Second Query has x,a,b fields
    now can i join the first and second query by the common field x.
    Without changing the infoprovider or multicube design,i want to join
    the query at the query level.
    I want to join the two queries using common field x and then replace
    the second query a, b fields with y, z fields data of query1.
    Regards

    Hi Santosh.
    If you want to use the workbook solution you should create one sheet for each query.
    Lets assume that you have X in column A in both sheets and Y and Z in column B and C in sheet1. For the columns D and E on sheet1 you should insert some VB-code that gets the data from sheet2 where X equals X from sheet1. Here is an example:
    =IF(ISNA(VLOOKUP(A1;sheet2!$A$1:$B$200;2;FALSE));"";(VLOOKUP(A1;sheet2!$A$1:$B$200;2;FALSE)))
    You will have to use this code for all the rows along the column. I.e. if A has an output of 200 rows, you will need the code from line 1->200. You will also have to consider that the results may be more in the future.
    Hope it helps.
    BR
    Stefan

  • How can I run two independant LabView applications from the same computer, without taking a performance hit?

    I have two identical, but independant test stations, both feeding data back to a Data Acquisition Computer running LabView 6.1. Everything is duplicated at the computer as well, with two E-series multifunction I/O cards (one for each test station) and two instances of the same LabView program for acquiring and analysing the data. The DAQ computer has a Celeron processor w/ 850Mhz clock and 512MB memory, and is running on Windows NT.
    I have noticed that when I run both the applications simultaneously, I take a substantial performance hit in terms of processing speed (as opposed to running just one program). Why does this happen and how can I prevent it? (In t
    his particular case, it may be possible to combine both the tests into one program since they are identical, but independant, simultaneous control of two different LabView programs is a concept I need to prove out).
    Thanks in advance for any tips, hints and spoon feedings (!)....

    Depending on your application, you may or may not be able to improve things.
    Firstly, each task requires CPU time, so a certain performance difference is guaranteed. Making sure you have a "wait until ms" in every while loop helps in all but the most CPU intensive programs.
    Secondly, if you are
    1) streaming data to disk
    2) Acquiring lots of data over the PCI bus
    3) Sending lots of data o ver the network
    you can have bottlenecks elsewhere than in your program (limited Disk, PCI or Network bandwidth).
    Avoid also displaying data which doesn`t need to be displayed. An array indicator which only shows one element still needs a lot of processing time if the array itself is large.... Best is to set the indicator invisible if this is the case.
    I think
    it would be best if you could give some more information about the amount of data being acquired, processed and sent. Then maybe it will be more obvious where you can optimise things. If you are running W2000, try activating the task manager while the program(s) are sunning to see where the bottleneck is.
    Shane
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Outer join: difference between two queries

    Below two queries that should give the same results in my opinion. I want all the records from u_protocol and only the value of pval.u_protocol_variable_value if present.
    Why does the outer join in query2 doesn't work like in query1?
    Query1:
    select p.u_protocol_id, i.u_protocol_variable_value
    from lims_sys.u_protocol p,
       select pval.u_protocol_id, pval.u_protocol_variable_value
       from lims_sys.u_protocol_variable pvar, lims_sys.u_protocol_value_user pval
       where pvar.u_protocol_variable_id = pval.u_protocol_variable_id
       and pvar.name = 'VALUE_Protocol_Group'
    ) i  
    where p.u_protocol_id  = i.u_protocol_id (+)
    Query2:
    select prt.u_protocol_id, pval.u_protocol_variable_value
    from lims_sys.u_protocol prt, lims_sys.u_protocol_variable pvar, lims_sys.u_protocol_value_user pval
    where pvar.u_protocol_variable_id = pval.u_protocol_variable_id
    and prt.u_protocol_id = pval.u_protocol_id (+)
    and pvar.name = 'VALUE_Protocol_Group'

    In the first query restriction pvar.name = 'VALUE_Protocol_Group' is limited to your inline view. So when you do a outer join with the u_protocol table you will get the number of records which are there in the u_protocol table.
    But when you gave the restriction pvar.name = 'VALUE_Protocol_Group' outside the inline view, the restriction was based on the resultset as a whole. So you will get only those records which have pvar.name = 'VALUE_Protocol_Group' condition satisfied.
    Hope the following illustration helps:
    SQL> CREATE TABLE TEST_TAB
      2  AS
      3  SELECT level col_1, chr(65+level-1) col_2 FROM Dual
      4  CONNECT BY LEVEL <= 10
      5  /
    Table created.
    SQL> SELECT * FROM TEST_TAB
      2  /
         COL_1 COL_
             1 A
             2 B
             3 C
             4 D
             5 E
             6 F
             7 G
             8 H
             9 I
            10 J
    10 rows selected.
    SQL> CREATE TABLE TEST_TAB_B
      2  AS
      3  SELECT level col_3, chr(65+level-1) col_4 FROM Dual
      4  WHERE Level NOT IN (2,3,4)
      5  CONNECT BY LEVEL <= 10
      6  /
    Table created.
    SQL> SELECT * FROM TEST_TAB_B
      2  /
         COL_3 COL_
             1 A
             5 E
             6 F
             7 G
             8 H
             9 I
            10 J
    7 rows selected.
    SQL> SELECT a1.col_1, a1.col_2, a2.col_3, a2.col_4 FROM TEST_TAB a1,
      2  TEST_TAB_B a2
      3  where a1.col_1 = a2.col_3(+)
      4  order by a1.col_1
      5  /
         COL_1 COL_      COL_3 COL_
             1 A             1 A
             2 B
             3 C
             4 D
             5 E             5 E
             6 F             6 F
             7 G             7 G
             8 H             8 H
             9 I             9 I
            10 J            10 J
    10 rows selected.Notice the output without any extra conditions: You will get all the values from TEST_TAB and matching records from TEST_TAB_B. Non-matching records are outputed as NULL.
    Following Query is resemblence to your first query
    SQL> SELECT a1.col_1, a1.col_2, a2.col_3, a2.col_4 FROM TEST_TAB a1,
      2  (SELECT * FROM TEST_TAB_B where col_4='A') a2
      3  where a1.col_1 = a2.col_3(+)
      4  order by a1.col_1
      5  /
         COL_1 COL_      COL_3 COL_
             1 A             1 A
             2 B
             3 C
             4 D
             5 E
             6 F
             7 G
             8 H
             9 I
            10 J
    10 rows selected.Here TEST_TAB_B Table is restricted with a condition which will restrict the inline view to have only one record. So when you outer join the inline view you will get output as shown above.
    The following query resembles to your second query.
    SQL> SELECT a1.col_1, a1.col_2, a2.col_3, a2.col_4 FROM TEST_TAB a1,
      2  TEST_TAB_B a2
      3  where a1.col_1 = a2.col_3(+)
      4  and a2.col_4 = 'A'
      5  order by a1.col_1
      6  /
         COL_1 COL_      COL_3 COL_
             1 A             1 A
    1 row selected.
    SQL> DROP TABLE TEST_TAB_B
      2  /
    Table dropped.
    SQL> DROP TABLE TEST_TAB
      2  /
    Table dropped.
    SQL> To understand this lets break up the resultset.
    Resultset brought by join condition would be something like :
        COL_1 COL_      COL_3 COL_
             1 A             1 A
             2 B
             3 C
             4 D
             5 E             5 E
             6 F             6 F
             7 G             7 G
             8 H             8 H
             9 I             9 I
            10 J            10 JAgreed?
    Now when you add the extra condition a2.col_4 = 'A' thecondition will act upon the above resultset there by restricting the records to:
         COL_1 COL_      COL_3 COL_
             1 A             1 AHope this helps.
    Regards,
    Jo

Maybe you are looking for

  • Edit Button Not Working in PDF Portfolio

    The Edit function is greyed out whenever I try to create a PDF portfolio directly from an Outlook mail folder. We are using Adobe Pro X.  Any suggestions on why this is and how to fix?  I've been able to create other portfolios and use the Edit butto

  • Bug #18104 still exists

    Hello, I am quite disappointed about BDB 5. One of the most nasty bugs (#18104) still exists. As soon as you want to use the set_thread_count() feature, BDB will not free the thread-control-block. If you connect/disconnect, BDB will stop working quit

  • Screen Redraw / Macbook Silver / 4 Months old

    Here is a screen grab of the problem. Only does it when scrolling. http://www.millerandmiller.co.uk/screen/screen.png Looks like a graphic chip problem. Any body else have this problem? Thanks, James

  • Embedding a text field in a graphic OR custom text field look

    Hello all, I'm trying to create an application where the text field is visually appealing. If any of you have MSN Messanger on your BBs, I'm trying to have a text field similar to the one in the sign-in page. Any help would be appreciated

  • 2 Field Catalogues in ALV list

    Hi All, I want to have 2 headers in ALV list. So Can we have 2 field catalogue one after the other in a single ALV List. Where first header(row) gives title like "Previous 5 months " & 2nd header (row) gives sub title like " JAN  FEB  MAR  APR  MAY "