How can i optimize this querie

Hi oracle developers i want this query gonna be faster than it is but i cant find the way. With functions the result was improved but not enough. Anybody can help me. Exist sometool that i can use.
With explain Plan shows this:
HASH Join
Table Acces Full predetalle
TableAcces Full funciones
SELECT fun.fun_codigo                                   FUNCION
,fun.fun_desc FUNDESC
,SUM(NVL(pdt.pdt_disp,0)) DISPONIBLE
,SUM(NVL(pdt.pdt_apart,0)) APARTADO
,SUM(NVL(pdt.pdt_comp,0)) COMPROMETIDO
,SUM(NVL(pdt.pdt_real,0)) REAL
,SUM(NVL(pdt.pdt_presup,0)) PRESUPUESTADO
,SUM(pk_presupuestos.SumRealAcumuladoByFuncion(pdt.pdt_fun_codigo, pdt.pdt_per_anio, pdt.pdt_per_period, pdt.pdt_con_codigo)) REALACUM
,SUM(pk_presupuestos.SumPresAcumuladoByFuncion(pdt.pdt_fun_codigo, pdt.pdt_per_anio, pdt.pdt_per_period, pdt.pdt_con_codigo)) PRESUPACUM
,SUM(pk_presupuestos.SumRealAnualByFuncion(pdt.pdt_fun_codigo ,pdt.pdt_per_anio ,pdt.pdt_con_codigo)) REALANUAL
,SUM(pk_presupuestos.SumPresAnualByFuncion(pdt.pdt_fun_codigo ,pdt.pdt_per_anio ,pdt.pdt_con_codigo)) PRESUPANUAL
,fun.fun_tipo TIPO
FROM FUNCIONES fun
     ,PREDETALLE pdt
WHERE pdt.pdt_fun_codigo = fun.fun_codigo--fun.fun_codigo = pdt.pdt_fun_codigo
AND pdt.pdt_per_anio = :anio
AND pdt.pdt_per_period = :periodo
AND pdt.pdt_vigente = 'V'
AND ( :usuario IN (SELECT ful_empl_id FROM FUNNIVEL WHERE ful_fun_codigo = pdt.pdt_fun_codigo)
OR :usuario IN (SELECT vep_empl_id FROM VERPRESUP WHERE vep_fun_codigo = pdt.pdt_fun_codigo)
OR :usuario IN (SELECT fun_empl_resp FROM FUNCIONES WHERE fun_codigo = pdt.pdt_fun_codigo))
GROUP BY fun.fun_codigo
,fun.fun_desc
,fun.fun_tipo;

You might try replacing the multiple IN statements with
AND :usuario IN (SELECT ful_empl_id
                   FROM FUNNIVEL
                   WHERE ful_fun_codigo = pdt.pdt_fun_codigo
                   UNION ALL
                   SELECT vep_empl_id
                   FROM VERPRESUP
                   WHERE vep_fun_codigo = pdt.pdt_fun_codigo
                   UNION ALL
                   SELECT fun_empl_resp
                   FROM FUNCIONES
                   WHERE fun_codigo = pdt.pdt_fun_codigo)TTFN
John

Similar Messages

  • Can anyone tell me how can i optimize this query...

    Can anyone tell me how can i optimize this query ??? :
    Select Distinct eopersona.numident From rscompeten , rscompet , rscv , eopersona , rscurso , rseduca , rsexplab , rsinteres
    Where ( ( (LOWER (rscompeten.nombre LIKE '%caracas%') AND ( rscompeten.id = rscompet.idcompeten ) AND ( rscv.id = rscompet.idcv ) AND ( eopersona.id = rscv.idpersona ) )
    OR ( (LOWER (rscurso.nombre) LIKE '%caracas%') AND ( rscv.id = rscurso.idcv ) AND ( eopersona.id = rscv.idpersona ) )
    OR ( (LOWER (rscurso.lugar) LIKE '%caracas%') AND ( rscv.id = rscurso.idcv ) AND ( eopersona.id = rscv.idpersona ) )
    OR ( (LOWER (rseduca.univinst) LIKE '%caracas%)' AND ( rscv.id = rseduca.idcv ) AND ( eopersona.id = rscv.idpersona ) )
    OR ( (LOWER (rsexplab.nombempre) LIKE '%caracas%' AND ( rscv.id = rsexplab.idcv ) AND ( eopersona.id = rscv.idpersona ) )
    OR ( (LOWER (rsinteres.descrip) LIKE '%caracas%' AND ( rscv.id = rsinteres.idcv ) AND ( eopersona.id = rscv.idpersona ) )
    OR ( (LOWER (rscv.cargoasp) LIKE '%caracas%' AND ( eopersona.id = rscv.idpersona ) )
    OR ( LOWER (eopersona.ciudad) LIKE '%caracas%' AND ( eopersona.id = rscv.idpersona )
    PLEASE IF YOU FIND SOMETHING WRONG.. PLEASE HELP ME.. this query takes me aproximatelly 10 minutes and the database is really small ( with only 200 records on each table )

    You are querying eight tables, however in any of your OR predicates you're only restricting 3 or 4 of those tables. That means that the remaining 4 or 5 tables are generating cartesian products. (n.b. the cartesian product of 5 tables with 200 rows each results in g 200^5 = 320,000,000,000 rows) Then you casually hide this behind "distinct".
    A simple restatement of your requirements looks like this:
    Select eopersona.numident
      From rscompeten,
           rscompet,
           rscv,
           eopersona
    Where LOWER (rscompeten.nombre) LIKE '%caracas%'
       AND rscompeten.id = rscompet.idcompeten
       AND rscv.id = rscompet.idcv
       AND eopersona.id = rscv.idpersona
    UNION
    Select eopersona.numident
      From rscurso ,
           rscv,
           eopersona
    Where LOWER (rscurso.nombre) LIKE '%caracas%'
       AND rscv.id = rscurso.idcv
       AND eopersona.id = rscv.idpersona
    UNION
    Select eopersona.numident
      From rscurso ,
           rscv,
           eopersona
    Where LOWER (rscurso.lugar) LIKE '%caracas%'
       AND rscv.id = rscurso.idcv
       AND eopersona.id = rscv.idpersona
    UNION
    ...From there you can eliminate redundancies as desired, but I imagine that the above will perform admirably with the data volumes you describe.

  • How can i optimize this method

    protected String getTheRealKey(String currentLevel, String keyWithStar) {
    int starIndex = keyWithStar.indexOf("*");
    String keyInCollection;
    while (starIndex != -1) {
    keyInCollection = StringValue.first(currentLevel.substring(starIndex));
    keyWithStar = keyWithStar.substring(0, starIndex) + keyInCollection + keyWithStar.substring(starIndex+1);
    starIndex = keyWithStar.indexOf("*");
    return keyWithStar;
    }

    I do not see how you could optimize it further unless you wanted to use RegEx via String.replaceAll() in 1.4 and higher. However, it is rare that string manipulation will be your scaling bottleneck.
    - Saish

  • How can i optimize this SQL

    Is there anyway i could optimize the below mentioned SQL. Since our test DB is down now, i'll be posting the EXPLAIN PLAN later.
    Is there anything i could do syntactically to optimize this sql?
    SELECT SUBSTR(STK_INF.TASK_GENRTN_REF_NBR,1,12) AS PICK_WAVE_NBR,
                     ( CASE WHEN ( SUM(STK_INF.QTY_ALLOC) > 0 ) THEN
            ROUND ( (SUM(CASE WHEN (STK_INF.NEXT_TASK_ID = 0 AND STK_INF.ALLOC_INVN_DTL_ID = 0) THEN
            STK_INF.QTY_ALLOC ELSE 0 END ) / (SUM(STK_INF.QTY_ALLOC))),2 ) * 100
            ELSE 0 END ) AS PICK_PER,
         ( CASE WHEN ( SUM(STK_INF.QTY_ALLOC) > 0 ) THEN
           ROUND( (SUM(CASE WHEN (STK_INF.NEXT_TASK_ID = 0 AND STK_INF.ALLOC_INVN_DTL_ID = 0) THEN
           STK_INF.QTY_PULLD ELSE 0 END ) / (SUM(STK_INF.QTY_ALLOC))),2 ) * 100
           ELSE 0 END ) AS TILT_PERCENT
         FROM STK_INF, TRK_DTL
         WHERE STK_INF.TASK_GENRTN_REF_CODE = '44' AND STK_INF.CARTON_NBR IS NOT NULL
          AND ((STK_INF.NEXT_TASK_ID = 0 AND STK_INF.STAT_CODE <= 90) OR (STK_INF.NEXT_TASK_ID > 0 AND STK_INF.STAT_CODE < 99))
          AND PULL_LOCN_ID = TRK_DTL.LOCN_ID(+) AND (TRK_DTL.AREA <>'C' OR TRK_DTL.AREA IS NULL)
         GROUP BY SUBSTR(STK_INF.TASK_GENRTN_REF_NBR,1,12)

    This is the EXPLAIN PLAIN i got after i issued EXECUTE DBMS_STATS.GATHER_TABLE_STATS ('schema_name','table_name'); for both the tables involved.
    The number of row returned is still 222 rows. But in the EXPLAIN PLAN it is shown as 3060 !!
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3267659036
    | Id  | Operation               | Name     | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |          |  3060 |   194K|       | 16527  (10)| 00:03:19 |
    |   1 |  HASH GROUP BY          |          |  3060 |   194K|       | 16527  (10)| 00:03:19 |
    |*  2 |   FILTER                |          |       |       |       |            |          |
    |*  3 |    HASH JOIN RIGHT OUTER|          |   177K|    11M|  7344K| 16397  (10)| 00:03:17 |
    |   4 |     TABLE ACCESS FULL   | TRK_DTL |   313K|  3669K|       |  2378   (6)| 00:00:29 |
    |*  5 |     TABLE ACCESS FULL   | STK_INF |   177K|  9205K|       | 13030  (11)| 00:02:37 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - filter("TRK_DTL"."AREA"<>'C' OR "TRK_DTL"."AREA" IS NULL)
       3 - access("PULL_LOCN_ID"="TRK_DTL"."LOCN_ID"(+))
       5 - filter("STK_INF"."CARTON_NBR" IS NOT NULL AND
                  "STK_INF"."TASK_GENRTN_REF_CODE"='44' AND ("STK_INF"."NEXT_TASK_ID"=0 AND
                  "STK_INF"."STAT_CODE"<=90 OR "STK_INF"."NEXT_TASK_ID">0 AND
                  "STK_INF"."STAT_CODE"<99))
    22 rows selected.You mentioned about creating indexes in STK_INF table. STK_INF.NEXT_TASK_ID has 186385 distinct values out of a total 782087. Does NEXT_TASK_ID make a good candidate for a B-Tree index
    STK_INF.STAT_CODE has only four distinct values, would this make a good candidate for a Bitmap index?

  • How can I optimize this CAN program?

    I currently have the program called "GCS message.vi". It reads CAN messages and has the ability to alter them. It then resends the CAN messages out. "GCS message stim and monitor.vi" runs with this, but does the opposite. It sends out messages, and then monitors the ouput of "GCS message.vi". This program runs at only a couple of Hertz, but when all the CAN programming is eliminated, the program runs extremely fast. And if all the excess programming is eliminated leaving only sending and receiving of CAN messages, then the program runs extremely fast again. I'm wondering what aspect of the program is slowing everything down and how I could program around it.
    Notes:
    The stim and monitor should be run first, and the start button on the VI should be pressed once the message vi is running.
    To check the execution speed, put a value in the "Inject Selected Errors" box and click the button next to it. It will countdown to zero.
    Attachments:
    GCS.zip ‏400 KB

    Hello,
    As you have noted, your problem seems to be purely LabVIEW. When you run with just your CAN commands, things are fast. One thing to note in your program (looking in CGS message.vi) is the large number of property node accesses; each access to a property node will cause a thread swap to the user interface (in the event that multiple threads have been spawned, which appears likely since you define multiple parallel tasks). Given that you have a relativel complicated GUI there, this may indeed affect performance significantly. In general, you should (if at all possible) use wires to dictate value assignment, and if necessary you may try changing the some of your property nodes (the ones that simply change the value of a control or indicator) to local variables to prevent the thread swapping. Now, this may not be the only performance enhancement to make; I would strongly recommend reading the following document to help get a better idea for how to find and correct memory and time performance issues in LabVIEW:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/732CEC772AA4FBE586256A37005541D3
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • How can I optimize this script?

    What I don't like about this script:
    1) It has to be run multiple times to process multiple staff. I'd prefer if I could input multiple employee numbers at once
    2) It takes so long to search for the user. If I use the script, it can currently take 30s to find the employee. When I use ADUC to run the "(&(objectCategory=user)(objectClass=user)(employeeID=17688))" search, the results are immediate.
    3) I'd like it to look through all the chosen employee numbers before replicating the domain.
    4) The end of the powershell script calls a batch file because the syntax in the batch file didn't work in powershell. Can the batch file commands be included directly in the powershells script?
    5) The batch file references all of our DC's to minimize replication latency. Can it be simplified while ensuring all DC's are hit ASAP?
    Here is the powershell script:
    #Disable User# Add the Quest ActiveRoles Management Shell snap-in to recognize extended commands
    Add-PSSnapin Quest.ActiveRoles.ADManagement
    # Take first commandline argument which is the employeeID and assign it to the $empID variable
    $empID=$Args[0]
    # Search for the EmployeeID and find the matching NTAccountName (NBDomain\*) [This takes about 30 seconds for 1400 users]
    Write-Host "Searching for the User which matches Employee ID $EmpID, you have about 30 seconds to press Ctrl-C to cancel..."
    $user = get-qaduser -includedproperties employeeID,samaccountname -sizelimit 0 | where {$_.employeeID -eq $empID}
    # Find the matching SAMAccountname
    $samaccountname = $user.samaccountname
    # Find the matching DN
    $SourceDN = $user.dn
    # Set where the disabled account will be moved
    $DestDN = "OU=Disabled Accounts,DC=domain,DC=Com"
    # Set recipient limits to 0
    set-mailbox -identity $samaccountname -recipientlimits 0
    Write-host $User Recipient Limit set to 0.
    # Disable all mailbox features except archive
    set-casmailbox -identity $samaccountname -owaenabled $false -ewsenabled $false -ecpenabled $false -mapienabled $false -mapiblockoutlookrpchttp $true -ewsallowmacoutlook $false -ewsallowoutlook $false
    set-casmailbox -identity $samaccountname -activesyncenabled $false -popenabled $false -imapenabled $false
    Write-host $User Exchange features disabled.
    # Block all devices associated with the mailbox:
    $DeviceIDs = (Get-ActiveSyncDeviceStatistics -Mailbox $SourceDN | foreach { $_.DeviceID } )
    Set-CASMailbox -Identity $SourceDN -ActiveSyncBlockedDeviceIDs $DeviceIDs
    Write-Host $User All approved devices have been blocked.
    # Remove all devices associated with the mailbox:
    Set-casmailbox -identity $samaccountname -ActiveSyncAllowedDeviceIDs $null
    Write-Host $User All ActiveSync devices removed from mailbox.
    #Disable the user
    Disable-QADUser $user
    Write-Host $user account disabled.
    # Move the user to the Disabled OU
    Dsmove $SourceDN -newparent $DestDN
    Write-Host $User account moved to Disabled OU.
    Write-host Finished processing user $User
    Write-host ""
    Write-host "Replicating the enterprise domain across sites..."
    cd "C:\Users\username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Admin Tools"
    .\"Force DC replication.cmd"
    cd "c:\scripts"
    pause

    Here's the script I'm happy with. It's just .\scriptname.ps1 xxxx xxxy xxxz, where the args are employee numbers.
    #Disable User
    import-module activedirectory
    cls
    $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes",""
    $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No",""
    $choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
    foreach ($empID in $args)
    # Search for the EmployeeID and find the matching NTAccountName (domain\*)
    $user=get-aduser -properties employeeID,samaccountname -resultsetsize $null -LDAPFilter "(employeeID=$empID)"
    $samaccountname = $user.samaccountname
    $DN=$user.distinguishedname
    $name=$user.name
    $caption = "Warning!"
    $message = "Do you want to disable " + $name + "?"
    $result = $Host.UI.PromptForChoice($caption,$message,$choices,0)
    if($result -eq 1) { Write-Host "Skipping to the next name (if available)" }
    if($result -eq 1) { continue}
    if($result -eq 0) { Write-Host "----------"}
    if($result -eq 0) { Write-Host "Processing $name"}
    # Set recipient limits to 0
    set-mailbox -identity $samAccountName -recipientlimits 0
    Write-host "$name Recipient Limit set to 0."
    # Disable all mailbox features except archive
    set-casmailbox -identity $samaccountname -owaenabled $false -ewsenabled $false -ecpenabled $false -mapienabled $false -mapiblockoutlookrpchttp $true -ewsallowmacoutlook $false -ewsallowoutlook $false
    set-casmailbox -identity $samaccountname -activesyncenabled $false -popenabled $false -imapenabled $false
    Write-host "$name Exchange features disabled."
    # Block all devices associated with the mailbox:
    $DeviceIDs = (Get-ActiveSyncDeviceStatistics -Mailbox $dn | foreach { $empID.DeviceID } )
    Set-CASMailbox -Identity $DN -ActiveSyncBlockedDeviceIDs $DeviceIDs
    Write-Host "$name All approved devices have been blocked."
    # Remove all devices associated with the mailbox:
    Set-casmailbox -identity $samAccountName -ActiveSyncAllowedDeviceIDs $null
    Write-Host "$name All ActiveSync devices removed from mailbox."
    #Disable the user
    set-aduser $samAccountname -Enabled $false
    Write-Host "$name account disabled."
    # Move the user to the Disabled OU
    Move-ADObject -TargetPath "OU=Disabled Accounts,DC=domain,DC=Com" -Identity $dn
    Write-Host "$name account moved to Disabled OU."
    Write-host "Finished processing user $name."
    Write-host "----------"
    # Recycle the IIS Application Pools to clear the token cache
    Write-Host "Recycling IIS Application pools to clear the token cache..."
    $pools=Get-WMIObject IISApplicationPool -Namespace root\MicrosoftIISv2 -authentication Packetprivacy -computername cas001
    $pools | %{$_.Recycle()}
    $pools=Get-WMIObject IISApplicationPool -Namespace root\MicrosoftIISv2 -authentication Packetprivacy -computername cas002
    $pools | %{$_.Recycle()}
    Write-Host "Client Access IIS Application pools have been recycled."
    Write-host ""
    Write-host "Replicating the enterprise domain across sites..."
    repadmin /syncall dc003.domain.com /APed
    repadmin /kcc dc004.domain
    repadmin /kcc dc003.domain
    repadmin /kcc dc002.domain
    repadmin /kcc dc01.domain
    Write-Host "Replication requested, script complete."

  • How can i optimize this query

    SELECT c1,c2 FROM tabla WHERE c1=(SELECT MIN(c1) FROM tabla)
    (i want to get an unique register which contains the minimum value in the table for the field c1)

                                        C1                                     C2
                                         1                                     -1
                                         2                                     -2
                                         3                                     -3
                                         4                                     -4
                                         5                                     -5
                                         6                                     -6
                                         7                                     -7
                                         8                                     -8
                                         9                                     -9
                                        10                                    -10
    10 rijen zijn geselecteerd.
    SQL>
    SQL> SELECT c1,c2 FROM tabla WHERE c1=(SELECT MIN(c1) FROM tabla)
      2  /
                                        C1                                     C2
                                         1                                     -1
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE
       1    0   FILTER
       2    1     TABLE ACCESS (FULL) OF 'TABLA'
       3    1     SORT (AGGREGATE)
       4    3       TABLE ACCESS (FULL) OF 'TABLA'
    SQL>
    SQL> SELECT c1,c2
      2          FROM
      3                  (
      4                  SELECT c1,c2, ROW_NUMBER() OVER (ORDER BY C1) RN
      5                          FROM tabla
      6                  )
      7          WHERE RN = 1
      8  /
                                        C1                                     C2
                                         1                                     -1
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE
       1    0   VIEW
       2    1     WINDOW (SORT PUSHED RANK)
       3    2       TABLE ACCESS (FULL) OF 'TABLA'
    SQL>
    SQL> select min(c1) keep (dense_rank first order by c1) c1
      2       , min(c2) keep (dense_rank first order by c1) c2
      3    from tabla
      4  /
                                        C1                                     C2
                                         1                                     -1
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE
       1    0   SORT (AGGREGATE)
       2    1     TABLE ACCESS (FULL) OF 'TABLA'Regards,
    Rob.

  • How can i optimize this method,,,,,to increase its performance

    protected String getTheRealKey(String currentLevel, String keyWithStar) {
    int starIndex = keyWithStar.indexOf("*");
    String keyInCollection;
    while (starIndex != -1) {
    keyInCollection = StringValue.first(currentLevel.substring(starIndex));
    keyWithStar = keyWithStar.substring(0, starIndex) + keyInCollection + keyWithStar.substring(starIndex+1);
    starIndex = keyWithStar.indexOf("*");
    return keyWithStar;
    }

    STOP POSTING THIS MESSAGE YOU IDIOT!
    http://forum.java.sun.com/thread.jspa?threadID=653871&tstart=0

  • How can I optimize this query's performance

    SELECT pu.user_id,
    cd.owner,
    cd.somedata
    FROM client_detail cd,
    client_detail_user_xref pu
    WHERE cd.device_id = 'xxxxxxxxx'
    AND cd.client_detail_id = pu.client_detail_id(+)
    AND(cd.alt_user_id = '12345' OR pu.user_id = '67890')
    Plan hash value: 3532311591
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 247 | 1374 (1)| 00:00:17 |
    |* 1 | FILTER | | | | | |
    | 2 | NESTED LOOPS OUTER | | 1 | 247 | 1374 (1)| 00:00:17 |
    |* 3 | TABLE ACCESS FULL | CLIENT_DETAIL | 1 | 226 | 1371 (1)| 00:00:17 |
    | 4 | TABLE ACCESS BY INDEX ROWID| CLIENT_DETAIL_USER_XREF | 1 | 21 | 3 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | CLIENT_DETAIL_USER_PK | 1 | | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter("CD"."ALT_USER_ID"='12345' OR "PU"."USER_ID"='67890')
    3 - filter("CD"."DEVICE_ID"='xxxxxxxxx')
    5 - access("CD"."CLIENT_DETAIL_ID"="PU"."CLIENT_DETAIL_ID"(+))
    Edited by: user13805875 on Feb 24, 2011 5:13 AM

    If you are posting a Performance Related Question. Please read
    {thread:id=501834} and {thread:id=863295}.
    Following those guide will be very helpful.

  • How can I optimize the performance of my HTML5 project?

    The link to my project is below. It is very slow to load most slides until they are cached in the browser. It appears that it is waiting until I advance to the slide in order to download the content.  It takes up to 5 seconds to display the content of a slide, and often times it shows the spinning loading icon. With HTML5 output, it automatically converts my 1280x720 images to PNG files which does not help. How can I optimize this project to make everything load faster? Is there a way for Captivate to constantly download slides before you view them? Please let me know if you have suggestions.
    http://www.anacore.com/MediaStationSalesTool/
    Thanks

    Pasting into a blank project is not a nice option because it requires reconfiguring all of the buttons.They all reset to "Continue" when I do that. I would probably need to re-enter the Advanced Actions as well. There's no reason to think that would speed up the application.
    You can see the content in the link up top: http://www.anacore.com/MediaStationSalesTool/. There are mostly slides with video and slides with 1280x720 images. Click the grey buttons to navigate and use the bottom right buttons to return home. Please let me know if you have any suggestions.
    Thanks,
    Jim

  • My 2009 iMac freezes and won't run more than one application at a time - how can I fix this?

    Help! My iMac has been getting worse regarding freezing, especially when trying to open iPhoto. It will load slowly, and then I get the pinwheel of death for ever, until I shutdown and try over again. It usually takes several tries, and usually overnight. How can I resolve this issue?

    First, back up all data immediately, as your boot drive might be failing.
    Step 1
    This diagnostic procedure will query the log for messages that may indicate a system issue. It changes nothing, and therefore will not, in itself, solve your problem.
    If you have more than one user account, these instructions must be carried out as an administrator.
    Triple-click anywhere in the line below on this page to select it:
    syslog -k Sender kernel -k Message CReq 'GPU |hfs: Ru|I/O e|find tok|n Cause: -|NVDA\(|timed? ?o' | tail | open -ef
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key.
    The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear.
    A TextEdit window will open with the output of the command. Normally the command will produce no output, and the window will be empty. If the TextEdit window (not the Terminal window) has anything in it, stop here and post it — the text, please, not a screenshot. The title of the TextEdit window doesn't matter, and you don't need to post that.
    Step 2
    There are a few other possible causes of generalized slow performance that you can rule out easily.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Reset the System Management Controller.
    Run Software Update. If there's a firmware update, install it.
    If you're booting from an aftermarket SSD, see whether there's a firmware update for it.
    If you have a portable computer, check the cycle count of the battery. It may be due for replacement.
    If you have many image or video files on the Desktop with preview icons, move them to another folder.
    If applicable, uncheck all boxes in the iCloud preference pane. See whether there's any change.
    Check your keychains in Keychain Access for excessively duplicated items.
    Boot into Recovery mode, launch Disk Utility, and run Repair Disk.
    If you have a MacBook Pro with dual graphics, disable automatic graphics switching in the Energy Saverpreference pane for better performance at the cost of shorter battery life.
    Step 3
    When you notice the problem, launch the Activity Monitor application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Activity Monitor in the icon grid.
    Select the CPU tab of the Activity Monitor window.
    Select All Processes from the View menu or the menu in the toolbar, if not already selected.
    Click the heading of the % CPU column in the process table to sort the entries by CPU usage. You may have to click it twice to get the highest value at the top. What is it, and what is the process? Also post the values for User, System, and Idle at the bottom of the window.
    Select the Memory tab. What value is shown in the bottom part of the window for Swap used?
    Next, select the Disk tab. Post the approximate values shown for Reads in/sec and Writes out/sec (not Reads in andWrites out.)
    Step 4
    If you have more than one user account, you must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way you launched Activity Monitor. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Select the 50 or so most recent entries in the log. Copy them to the Clipboard by pressing the key combinationcommand-C. Paste into a reply to this message (command-V). You're looking for entries at the end of the log, not at the beginning.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some personal information, such as your name, may appear in the log. Anonymize before posting. That should be easy to do if your extract is not too long.

  • How can I handle multiple Queries in single Report?

    Using Reports 6.0, i have 2 queries Q_1, Q_2 and I have define a user parameter, Flag_1 char(1).
    I wish to execute Q_1 if Flag_1 = 'T' and Q_2 if flag_1 = 'F'
    How can i do this?

    Hello Fayad,
    Another way in which you can achieve the same result in one report is by framing your two queries something like:
    Q_1. select * from emp where :flag_1 = 'T'
    Q_2. select * from dept where :flag_2 = 'F'.
    This will cause the appropriate query to be executed, depending on the value of the flag_1 parameter. Additionally, you would need to create two report blocks in your layout, one for each of the above queries. You can create format triggers for the enclosing frame of these blocks, which will show/hide the entire block depending on the value of the flag_1 parameter. For example, the format trigger for the EMP report block (based on query Q_1) frame would look like:
    function M_G_EMPNO_GRPFRFormatTrigger return boolean is
    begin
    if (:p_1 = 10) then
    return (TRUE);
    else
         return (FALSE);
    end if;
    end;
    Thanks,
    The Oracle Reports Team.

  • How can I perform this kind of range join query using DPL?

    How can I perform this kind of range join query using DPL?
    SELECT * from t where 1<=t.a<=2 and 3<=t.b<=5
    In this pdf : http://www.oracle.com/technology/products/berkeley-db/pdf/performing%20queries%20in%20oracle%20berkeley%20db%20java%20edition.pdf,
    It shows how to perform "Two equality-conditions query on a single primary database" just like SELECT * FROM tab WHERE col1 = A AND col2 = B using entity join class, but it does not give a solution about the range join query.

    I'm sorry, I think I've misled you. I suggested that you perform two queries and then take the intersection of the results. You could do this, but the solution to your query is much simpler. I'll correct my previous message.
    Your query is very simple to implement. You should perform the first part of query to get a cursor on the index for 'a' for the "1<=t.a<=2" part. Then simply iterate over that cursor, and process the entities where the "3<=t.b<=5" expression is true. You don't need a second index (on 'b') or another cursor.
    This is called "filtering" because you're iterating through entities that you obtain from one index, and selecting some entities for processing and discarding others. The white paper you mentioned has an example of filtering in combination with the use of an index.
    An alternative is to reverse the procedure above: use the index for 'b' to get a cursor for the "3<=t.b<=5" part of the query, then iterate and filter the results based on the "1<=t.a<=2" expression.
    If you're concerned about efficiency, you can choose the index (i.e., choose which of these two alternatives to implement) based on which part of the query you believe will return the smallest number of results. The less entities read, the faster the query.
    Contrary to what I said earlier, taking the intersection of two queries that are ANDed doesn't make sense -- filtering is the better solution. However, taking the union of two queries does make sense, when the queries are ORed. Sorry for the confusion.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • After downloading the new Os X Yosemite my computer has been lagging, how can I fix this?

    After downloading the new OS X Yosemite my computer has been lagging, how can I fix this?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen. Click the Clear Display icon in the toolbar. Then take one of the actions that you're having trouble with. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • How can I combine two queries ? QoQ does not work

    I have one query where I just count the total qty coming in per month, something like:
    <cfquery name="qryIn" datasource="dbname">
    select count(orderNO) as totalIN,month
    where status = "IN"
    group by month
    </cfquery>
    I then have a second query to count the total qty going out per month
    <cfquery name="qryOut" datasource="dbname">
    select count(orderNO) as totalOut,month
    where status = "OUT"
    group by month
    </cfquery>
    I then use QoQ to combine both:
    <cfquery="qryTotal" dbtype="query">
    select
    totalIN,
    totalOUT
    from qryIN,qryOUT
    where qryIN.month = qryOUT.month
    </cfquery>
    The problem I am running into is that QoQ does not allow LEFT JOIN, so that if the month is in one query but not the other, it will not pick up that record. And that is throwing off my counts.
    How can I combine  both queries, and bypass QoQ to get a qty IN and qty Out value, per month ? and, for example, if qty in exists for one month and qty Out does not exists for that month, then qty Out will be zero for that month.
    I need this data to plot a chart.
    Thanks for any help provided.

    Do it in a single query to your database.  Here is part of it.
    select month
    , sum(case when when status = "IN" then 1 else 0 end) total_in

Maybe you are looking for