How to speed up a query?

I want to select the MM generated documents from BKPF table where the awkey = MM Invoice no + FY and the awtyp = "RMRP". However since the BKPF table is very huge it takes a lot of time to execute.
Hence i would like to know if there is any other faster way to speed this query?

Hi ,
Following points will help to improve performance.
1. Creation of secondary index with the fields you are using in select query.You need to do runtime anaysis and trace analysis to view the impact of this.
2. Try to minimize number of hits to the database table.Get the desired records from table in one go.
3. Try to minimize the records fetched from the table.You can achive this by making some fields on screen as mandatory and using them in where condition of select statement.
Hope this helps you.

Similar Messages

  • How to speed up this query?

    I have created a demo table:
    create table demo1(d date);
    and insert some data to table:
    begin
    -- add 6000000 rows
    for i in 1..1000000 loop
    insert into demo1 values(trunc(sysdate-i));
    insert into demo1 values(trunc(sysdate-i));
    insert into demo1 values(trunc(sysdate-i));
    insert into demo1 values(trunc(sysdate-i));
    insert into demo1 values(trunc(sysdate-i));
    insert into demo1 values(trunc(sysdate-i));
    end loop;
    commit;
    end;
    The query
    select * from demo1
    where d=to_date('25.10.2004','DD.MM.YYYY')
    executed three times faster than
    select from demo1 where d=trunc(sysdate-1);
    Why? How to speed up this query if I do not want to use index?
    I have created index:
    create index demo1_indx on demo1(d);
    Execution time of queries became identical (for this volume of data).

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create table demo1(d date);
    Table created.
    SQL> begin
    2 for i in 1..1000000 loop
    3 insert into demo1 values(trunc(sysdate-i));
    4 insert into demo1 values(trunc(sysdate-i));
    5 insert into demo1 values(trunc(sysdate-i));
    6 insert into demo1 values(trunc(sysdate-i));
    7 insert into demo1 values(trunc(sysdate-i));
    8 insert into demo1 values(trunc(sysdate-i));
    9 insert into demo1 values(trunc(sysdate-i));
    10 insert into demo1 values(trunc(sysdate-i));
    11 end loop;
    12 commit;
    13 end;
    14 /
    PL/SQL procedure successfully completed.
    SQL> alter session set timed_statistics=true;
    Session altered.
    SQL> alter session set sql_trace=true;
    Session altered.
    SQL> set timing on;
    SQL> set autotrace on;
    SQL> select * from demo1 where d='25.10.2004';
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:10.70
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3285 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3285 Card=159
    Bytes=1431)
    Statistics
    29 recursive calls
    1 db block gets
    28988 consistent gets
    13030 physical reads
    1035300 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d='25.10.2004';
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:03.35
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3285 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3285 Card=159
    Bytes=1431)
    Statistics
    0 recursive calls
    0 db block gets
    14441 consistent gets
    12837 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d='25.10.2004';
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:04.95
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3285 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3285 Card=159
    Bytes=1431)
    Statistics
    0 recursive calls
    0 db block gets
    14441 consistent gets
    12757 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d='25.10.2004';
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:03.82
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3285 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3285 Card=159
    Bytes=1431)
    Statistics
    0 recursive calls
    0 db block gets
    14441 consistent gets
    12752 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d=trunc(sysdate-3);
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:17.53
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3696 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3696 Card=159
    Bytes=1431)
    Statistics
    6 recursive calls
    0 db block gets
    14503 consistent gets
    12758 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d=trunc(sysdate-3);
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:15.82
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3696 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3696 Card=159
    Bytes=1431)
    Statistics
    0 recursive calls
    0 db block gets
    14441 consistent gets
    12753 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d=trunc(sysdate-3);
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:14.56
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3696 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3696 Card=159
    Bytes=1431)
    Statistics
    0 recursive calls
    0 db block gets
    14441 consistent gets
    12758 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> select * from demo1 where d=trunc(sysdate-3);
    D
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    25.10.04
    8 rows selected.
    Elapsed: 00:00:11.84
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3696 Card=159 Byte
    s=1431)
    1 0 TABLE ACCESS (FULL) OF 'DEMO1' (TABLE) (Cost=3696 Card=159
    Bytes=1431)
    Statistics
    0 recursive calls
    0 db block gets
    14441 consistent gets
    12757 physical reads
    0 redo size
    453 bytes sent via SQL*Net to client
    508 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    8 rows processed
    SQL> alter session set sql_trace=false;
    Session altered.
    Elapsed: 00:00:00.00
    SQL> alter session set timed_statistics=false;
    Session altered.
    Elapsed: 00:00:00.01
    SQL>

  • How to speed up the query result time

    While executing the following query the result comes after 22 secs.
    How could i minimize this time ? Please suggest.
    SELECT DISTINCT
           PERIOD_NO,
           ITEM_CODE,
           ITEM_NAME,
           SUM(CASE WHEN LEVEL_TYPE IN 'SUB ZONE' THEN WD_FORECAST_QTY_BU / CNV / ML ELSE 0 END)TOT_FRCST
    FROM   SHEET_HEAD, SHEET_DETAIL, ITEM_DETAIL
    WHERE  WH_SYS_ID = WD_WH_SYS_ID
    AND    ITEM_CODE = WD_ITEM_CODE(+)
    AND    PERIOD_NO BETWEEN :PERIOD1 AND :PERIOD2
    AND    WH_REVISION_NO = 0
    AND    WH_LEVEL_CODE NOT IN (SELECT WH_LEVEL_CODE FROM SHEET_HEAD WHERE WH_REVISION_NO = 1)
    GROUP BY   ITEM_CODE, ITEM_NAME, WH_PERIOD_NOSanjay

    Hi,
    with speed the suggest would always be expirement with indexing on the parameters, after first analysing what is currently happening in terms of full table scans etc that are 'most expensive'.
    In terms of the specifics on your code the following sticks out as costly; -
    AND    WH_LEVEL_CODE NOT IN (SELECT WH_LEVEL_CODE FROM SHEET_HEAD WHERE WH_REVISION_NO = 1)Here I would see if you can rewrite it, perhaps with a left join / self join to achieve the same ends, compare the timings you may be surprised.
    regards,
    Robert.

  • How to speed up the query time after adding order by

    Hi,
    In Form 6.0 front-end and 8i server, I put an "order by date
    column desc" in Block Property and when I hit query button the
    screen will bring up the most current date data instead of
    oldest date data. The problem is slowing down the query time,
    because the "order by" does the resorting work in the user temp
    table space. The base table to be queried also contains two
    varchar2(1500) columns and that also slow down the query time.
    I am wondering if there is any other way to bring the current
    records first without slow down the query speed ?
    Any thought will be helpful and appreciated.
    Thnaks!
    Tony
    null

    anthony hsu (guest) wrote:
    : Hi,
    : In Form 6.0 front-end and 8i server, I put an "order by date
    : column desc" in Block Property and when I hit query button the
    : screen will bring up the most current date data instead of
    : oldest date data. The problem is slowing down the query time,
    : because the "order by" does the resorting work in the user
    temp
    : table space. The base table to be queried also contains two
    : varchar2(1500) columns and that also slow down the query time.
    : I am wondering if there is any other way to bring the current
    : records first without slow down the query speed ?
    : Any thought will be helpful and appreciated.
    : Thnaks!
    : Tony
    What I have done is use hints to force the use of an index in
    descending order. The part of the following example that
    pertains to your question is the index_desc hint. Syntax and
    suggestions for using hints are in the Oracle documentation.
    The column you want to order desc by would have to be in an
    index. The following example creates a view which you might not
    need to do.
    create or replace view v_sample_result as
    select
    /*+
    first_rows
    index ( sa )
    index_desc ( t c_test_altk )
    index ( r c_result_pk )
    index ( lt )
    null

  • How to Speed up my query

    I have this below sample query with multiple joins involved, which is taking longer time than usual like around more than 5-10 min in the reports.
    I have 100,000 records in the application table. I started noticing the query got slowed down when i joined person p2 table to p5 table, i think joining same table multiple times is causing the issue
    Things i tried are using "+ 0" at the join condition, outer join and created a package which returns name when pid is sent, it doesn't make any difference.
    Is there any method to reduce the execution time. I haven't found anything similar topics around here, if anything i missed please redirect me. Thanks
    SELECT a.anumber,
    p1.name,
    p2.name,
    p3.name,
    p4.name,
    p5.name,
    o1.name,
    o2.name,
    fnc (business_day)
    FROM application a,
    person p1,
    person p2,
    person p3,
    person p4,
    person p5,
    office o1,
    office o2
    WHERE a.pid = p1.pid
    AND a.pid = p2.pid
    AND a.pid = p3.pid
    AND a.pid = p4.pid
    AND a.pid = p5.pid
    AND a.oid = o1.oid
    AND a.oid = o2.oid;
    Thanks
    Kumar

    @ user4530562: EMPLOYEE has 70,000 records, OFFICE has 3000 records, can you see added execution plan below and i did not use any indexes on my APPLICATION Table.
    @onedbguru: below i have the execution plan, just wanted you to tell that you would see other tables like status,description but those doesn't make the query slow.
    @ Thomas Morgan: Thanks for replicating the tables and query, but my EMPLOYEE table has multiple columns and my OFFICE table has multiple columns, i mentioned them in an overview state, as the information is secured i am sorry i cant reveal all the names, if can understand what i mean.Thank you so much.
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1302 Card=75183 Bytes=27516
    1 0 VIEW OF 'OFFICE_V' (VIEW) (Cost=57 Card=3 Bytes=405)
    2 1 SORT (UNIQUE) (Cost=57 Card=3 Bytes=239)
    3 2 UNION-ALL
    4 3 FILTER
    5 4 FAST DUAL (Cost=2 Card=1)
    6 3 FILTER
    7 6 FAST DUAL (Cost=2 Card=1)
    8 3 NESTED LOOPS (OUTER) (Cost=50 Card=1 Bytes=239)
    9 8 NESTED LOOPS (Cost=5 Card=1 Bytes=106)
    10 9 NESTED LOOPS (OUTER) (Cost=4 Card=1 Bytes=64)
    11 10 TABLE ACCESS (BY INDEX ROWID) OF 'OFFICE__U
    12 11 INDEX (UNIQUE SCAN) OF 'OFFICE_UNITS_PK' (IN
    13 10 TABLE ACCESS (BY INDEX ROWID) OF 'COST_ALLOCATION_K
    14 13 INDEX (UNIQUE SCAN) OF 'COST_ALLOCATION_KEYFLE_PK
    15 9 TABLE ACCESS (BY INDEX ROWID) OF 'LOCATIONS_ALL' (TABL
    16 15 INDEX (UNIQUE SCAN) OF 'LOCATIONS_PK' (INDEX (UNIQUE
    17 8 VIEW (Cost=45 Card=1 Bytes=133)
    18 17 NESTED LOOPS
    19 18 NESTED LOOPS (Cost=45 Card=40 Bytes=1720)
    20 19 TABLE ACCESS (BY INDEX ROWID) OF 'FND_FLEX_VALUES' (T
    21 20 INDEX (RANGE SCAN) OF 'FND_FLEX_VALUES_N2' (INDEX)
    22 19 INDEX (UNIQUE SCAN) OF 'FND_FLEX_VALUES_TL_U1' (INDEX
    23 18 TABLE ACCESS (BY INDEX ROWID) OF 'FND_FLEX_VALUES_TL' (
    24 0 TABLE ACCESS (BY INDEX ROWID) OF 'LOCATIONS_ALL' (TABLE) (Cost=2
    25 24 INDEX (UNIQUE SCAN) OF 'LOCATIONS_PK' (INDEX (UNIQUE)) (Cost=1
    26 0 VIEW OF 'EMPLOYEE_V' (VIEW) (Cost=24 Card=4 Bytes=860)
    27 26 SORT (UNIQUE) (Cost=24 Card=4 Bytes=301)
    28 27 UNION-ALL
    29 28 FILTER
    30 29 FAST DUAL (Cost=2 Card=1)
    31 28 FILTER
    32 31 FAST DUAL (Cost=2 Card=1)
    33 28 NESTED LOOPS
    34 33 NESTED LOOPS (Cost=15 Card=1 Bytes=106)
    35 34 TABLE ACCESS (BY INDEX ROWID) OF 'ALL_ASSIGNMENTS_F'
    36 35 INDEX (RANGE SCAN) OF 'ASSIGNMENTS_F_N12' (INDEX) (
    37 34 INDEX (RANGE SCAN) OF 'PEOPLE_F_PK' (INDEX (UNIQUE))
    38 33 TABLE ACCESS (BY INDEX ROWID) OF 'ALL_PEOPLE_F' (TABLE)
    39 28 TABLE ACCESS (BY INDEX ROWID) OF 'CONTRACTORS' (TABL
    40 39 INDEX (UNIQUE SCAN) OF 'CONTRACTORS_PK' (INDEX (UNIQUE))
    41 0 VIEW OF 'EMPLOYEE_V' (VIEW) (Cost=24 Card=4 Bytes=860)
    42 41 SORT (UNIQUE) (Cost=24 Card=4 Bytes=301)
    43 42 UNION-ALL
    44 43 FILTER
    45 44 FAST DUAL (Cost=2 Card=1)
    46 43 FILTER
    47 46 FAST DUAL (Cost=2 Card=1)
    48 43 NESTED LOOPS
    49 48 NESTED LOOPS (Cost=15 Card=1 Bytes=106)
    50 49 TABLE ACCESS (BY INDEX ROWID) OF 'ALL_ASSIGNMENTS_F'
    51 50 INDEX (RANGE SCAN) OF 'ASSIGNMENTS_F_N12' (INDEX) (
    52 49 INDEX (RANGE SCAN) OF 'PEOPLE_F_PK' (INDEX (UNIQUE))
    53 48 TABLE ACCESS (BY INDEX ROWID) OF 'ALL_PEOPLE_F' (TABLE)
    54 43 TABLE ACCESS (BY INDEX ROWID) OF 'CONTRACTORS' (TABL
    55 54 INDEX (UNIQUE SCAN) OF 'CONTRACTORS_PK' (INDEX (UNIQUE))
    56 0 TABLE ACCESS (BY INDEX ROWID) OF 'SUBJECT' (TABLE) (Cost=1
    57 56 INDEX (UNIQUE SCAN) OF 'SUBJECT_PK' (INDEX (UNIQUE)) (Cost=0 C
    58 0 TABLE ACCESS (BY INDEX ROWID) OF 'CATEGORY' (TABLE) (Cost=
    59 58 INDEX (UNIQUE SCAN) OF 'CATEGORY_PK' (INDEX (UNIQUE)) (Cost=0
    60 0 TABLE ACCESS (BY INDEX ROWID) OF 'PRE_DESCRIPTION' (TABLE)
    61 60 INDEX (UNIQUE SCAN) OF 'PRE_DESCRIPTION_PK' (INDEX (UNIQUE)) (Cos
    62 0 TABLE ACCESS (BY INDEX ROWID) OF 'ASSIGNED_GROUP' (TABLE)
    63 62 INDEX (UNIQUE SCAN) OF 'ASSIGNED_GROUP_PK' (INDEX (UNIQUE)) (Cost
    64 0 VIEW OF 'EMPLOYEE_V' (VIEW) (Cost=24 Card=4 Bytes=860)
    65 64 SORT (UNIQUE) (Cost=24 Card=4 Bytes=301)
    66 65 UNION-ALL
    67 66 FILTER
    68 67 FAST DUAL (Cost=2 Card=1)
    69 66 FILTER
    70 69 FAST DUAL (Cost=2 Card=1)
    71 66 NESTED LOOPS
    72 71 NESTED LOOPS (Cost=15 Card=1 Bytes=106)
    73 72 TABLE ACCESS (BY INDEX ROWID) OF 'ALL_ASSIGNMENTS_F'
    74 73 INDEX (RANGE SCAN) OF 'ASSIGNMENTS_F_N12' (INDEX) (
    75 72 INDEX (RANGE SCAN) OF 'PEOPLE_F_PK' (INDEX (UNIQUE))
    76 71 TABLE ACCESS (BY INDEX ROWID) OF 'ALL_PEOPLE_F' (TABLE)
    77 66 TABLE ACCESS (BY INDEX ROWID) OF 'CONTRACTORS' (TABL
    78 77 INDEX (UNIQUE SCAN) OF 'CONTRACTORS_PK' (INDEX (UNIQUE))
    79 0 TABLE ACCESS (BY INDEX ROWID) OF 'STATUS' (TABLE) (Cost=1
    80 79 INDEX (UNIQUE SCAN) OF 'STATUS_PK' (INDEX (UNIQUE)) (Cost=0 Card=
    81 0 TABLE ACCESS (FULL) OF 'APPLICATION' (TABLE) (Cost=1302 Card=7
    If this info is not sufficient please can you tell me whether there is any other solutions at the join condition that i can use like "+ 0", "(+)" or can i use functions/packages for office and employees to get names or any other methods other than joins.

  • How to 'speed up' snapshot query refreshes

    Is there a way to force snapshot queries to refresh? Is it tied to a job in the automation service?
    Sometimes there are little fires where i need docs to update right away and 'it'll take 15 minutes' isn't received very well...

    Is there a way to force snapshot queries to refresh? Is it tied to a job in the automation service?
    Sometimes there are little fires where i need docs to update right away and 'it'll take 15 minutes' isn't received very well...

  • How do I speed up this query by ignoring computers off the network faster?

    Good afternoon,
    I am running the below script to query the entire domain for local admins. Could anyone reccomend a way to speed this up by more quickly skipping computers that aren't on the network? Currently, every time it reaches a computer that is not on the network
    it hangs for up to 20 seconds (computers on the network return the data in less than a second). If I could decrease the ping time-out time, I could speed up this query tenfold.
    Script pasted below - Thank you!!!
    $Searcher = New-Object DirectoryServices.DirectorySearcher([ADSI]"")
    $Searcher.Filter = "(objectClass=computer)"
    $Computers = ($Searcher.Findall())
    md C:\Reports\IBX_Local_Admins_ALL
    Foreach ($Computer in $Computers)
    $Path=$Computer.Path
    $Name=([ADSI]"$Path").Name
    write-host $Name
    $members =[ADSI]"WinNT://$Name/Administrators"
    $members = @($members.psbase.Invoke("Members"))
    $members | foreach {$_.GetType().InvokeMember("Name", 'GetProperty',
    $null, $_, $null) | out-file -append C:\Reports\IBX_Local_Admins_ALL\$name.txt

    This version will not fail no matter what is in the group.
    function Get-LocalAdmins{
    [CmdLetBinding()]
    Param(
    [Parameter(
    Mandatory=$true,
    ValueFromPipeline=$true,
    Position=0
    )]$computer
    Process{
    Write-Verbose "Polling system: $computer"
    if(Test-Connection $Computer -quiet -count 1){
    $group=[ADSI]"WinNT://$computer/Administrators"
    $group.Invoke("Members") |
    ForEach-Object{
    New-Object PsObject -Property @{
    Computer=$Computer
    aDSPath=$_.GetType().InvokeMember('aDSPath', 'GetProperty',$null, $_, $null)
    #UserID=$_.GetType().InvokeMember('Name', 'GetProperty',$null, $_, $null)
    }else{
    Write-Warning "System not found: $computer"
    $computers=([adsisearcher]'(objectClass=computer)').FindAll() |%{$_.Properties['name']}
    $computers | Get-LocalAdmins -verbose
    ¯\_(ツ)_/¯
    Hi JRV,
    Thank you for your help so far! When I ran the above version, it seemed to be going fine but it stopped at a certain point saying the script was "successful", but it only queried 148 computers. I should note that it is also the same 148 computers each time
    I run it. No errors, it just stops and says successful. Any ideas?
    TY!

  • How to speed up SQL spatial query (spatial index error)

    Hi,
    Im trying to split polylines by points which have a small buffer around them. Currently i have over 370,000 lines and 320,000 nodes and the query is running really slowly (ive left it for 3 days and it still hasnt completed). I have tried forcing a spatial
    index using with (Index(SI_tempPD)) but i get the following error:
    "The query processor could not produce a query plan for a query with a spatial index hint. Reason: Could not find required binary spatial method in a condition. Try removing the index hints or removing SET FORCEPLAN."
    below is the snippet of code that im trying to run when i get the error:
    BEGIN INSERT INTO TempLines ( [linenum] ,[ogr_geometry] ) SELECT lines.[linenum] ,lines.[ogr_geometry].STDifference(points.[ogr_geometry].STBuffer(0.005)) AS ogr_geometry FROM dbo.TemplineData AS lines with(Index(SI_tempPD)) INNER JOIN dbo.[TemplineNodes] AS points ON lines.[ogr_geometry].STIntersection(points.[ogr_geometry]).STDistance(points.[ogr_geometry]) < 1 WHERE (lines.[linenum] <> points.[linenum]) END
     is there anyway i can speed up the query? (I also have a clustered primary key) the execution plan shows that a filter takes up 36% of the cost and the insert takes up 64%
    Any help would be greatly appreciated! (im using SQL Server 2008 (SQL server Management studio 10.50.1600.1))

    SQL Server spatial indexes don't support STDifference or STIntersection, see
    https://technet.microsoft.com/en-us/library/bb895373(v=SQL.105).aspx, which is why you get the error. 
    Your query is doing multiple expensive spatial operations against some fairly good-size tables in a join. You might get better results by either breaking the query into multiple simpler queries (SELECT into a temporary table and move the STDifference and
    STBuffer and INSERT off to a separate statement), and (if possible) rearchitecting the query to use STIntersects (which does support spatial index) rather than STIntersection.
    Hope this helps, Bob

  • My Mac has gone really slow since upgrading to Mavericks. Any suggestions as to how to speed things up again?

    My Mac has gone really slow since upgrading to Mavericks. Any suggestions as to how to speed things up again?

    First, back up all data immediately unless you already have a current backup. If you can't back up, stop here. Do not take any of the steps below.
    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\(|pagin|timed? ?o' | tail | awk '/:/{$4=""; print}' | 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.

  • Mac is slow. how to speed up

    My Mac (1 yr old) has slowed down.  How to speed it up?

    First, back up all data immediately, as your boot drive might be failing.
    Step 1
    This diagnostic procedure will query the system log for messages that may indicate a hardware fault. 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. I've tested them only with the Safari web browser. If you use another browser, they may not work as described.
    Triple-click anywhere in the line below on this page to select it:
    syslog -k Sender kernel -k Message CReq 'Channel t|GPU D|I/O|nspace-h|n Cause: -' | tail | open -ef
    Copy the selected text to the Clipboard (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).
    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.
    Reset the System Management Controller.
    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.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Check your keychains in Keychain Access for excessively duplicated items.
    Boot into Recovery mode, launch Disk Utility, and run Repair Disk.
    If you're booting from an aftermarket SSD, see whether there's a firmware update for it.
    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 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 System Memory tab. What values are shown in the bottom part of the window for Page outs and Swap used?
    Next, select the Disk Activity tab. Post the approximate values shown for Reads in/sec and Writes out/sec (not Reads in and Writes 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 (command-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.

  • Speed up "select" Query

    Hello friends,
    Please help me to reduce the execution time of below query………
    I am going to calculate some qty’s in my function. The below query is executed for each and every row , So How can I minimize the time of execution give me some tips because I have already check the explain plan and create all possible indexes but still it took too much time ….
    Please give me some tips or suggestion to speed up the query…
    SELECT SUM(BALANCE_INST_TO_RECD) BALANCE_INST_TO_RECD,
    SUM(Qtyissued) Qtyissued,
    SUM(qtyconsumed) qtyconsumed,
    SUM(nvl(Qtyissued,QTYRECD)-nvl(qtyconsumed,0)) balance_to_consume
    into l_BALANCE_INST_TO_RECD,l_ISSUE_QTY,l_ISSUE_CONSUME_QTY,l_BALANCE_TO_CONSUME_QTY
    FROM
    (select sum(Qtyissued) Qtyissued,
    sum(QtyRECD) QtyRECD,
    sum(BALANCE_INST_TO_RECD) BALANCE_INST_TO_RECD,
    (select NVL(sum(v.qtyissued), 0)+NVL(sum(v.qty1), 0)+NVL(sum(v.qty2), 0)
    from view_itemtran v
    where v.entity_code = r.entity_code
    and v.tcode = '0'
    and v.tnature = 'WJREC'
    and v.ref1_vrno = r.vrno
    and v.ref1_tcode = r.tcode
    and v.item_code = r.item_code
    and trunc(v.slno)<>v.slno
    AND not exists (select 1 from item_mast im
    where im.item_code=v.item_code
    and im.item_nature in ('SC','WA'))) qtyconsumed
    from
    (select ib.entity_code,
    ib.div_code,
    ib.tcode,
    ih.vrno,
    ih.vrdate,
    ib.item_code,
    ib.other_item_code service_code,
    IB.Qtyissued,
    IB.QtyRECD,
    to_number(lhs_prod.get_reallocate_instruction_no(ih.entity_code,ib.div_code,null,a_recd_item_code,ih.vrno,ih.acc_code,a_other_item_code,'B')) BALANCE_INST_TO_RECD
    from itemtran_head ih, itemtran_body ib
    where ih.entity_code = ib.entity_code
    and ih.tcode = ib.tcode
    and ih.vrno = ib.vrno
    and ih.entity_code =a_entity_code
    and ih.tcode = '0'
    and ih.vrno=NVL(a_issue_vrno,ih.vrno)
    and ib.div_code=a_div_code
    and ih.acc_code =a_acc_code
    and ib.item_code=nvl(l_inst_input_item_code,ib.item_code)
    and ((l_item_nature not in ('SC','WA') and ib.item_code=l_inst_input_item_code)
    OR (l_item_nature in ('SC','WA') AND IB.ITEM_CODE IN (SELECT item_code
    FROM VIEW_SCRAP_LOSS_ITEM
    WHERE SCRAP_ITEM_CODE=a_recd_item_code
    and item_code in (select item_code from view_itemtran
    where entity_code=a_entity_code
    and div_code=a_div_code
    and tcode='0'
    and tnature='WJISS'
    and vrno=NVL(a_issue_vrno,VRNO)))))
    --and nvl(IB.Qtyissued,0)>0
    ) r
    group by entity_code,div_code,vrno,tcode,vrdate,item_code);
    DB Version:-==Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    Thanks

    A few basic suggestions:
    1) I'd take out the OR and replace it with 2 queries unioned together.
    2) You say it's being called for every row. This implies another query is driving it. Can't you incorporate that query with this one so that most of the work is done in the database? If your SQL is being called in a post-query trigger on a form perhaps make a view incorporating this query and your base table.
    3) You've got 2 INs here:
                                         AND IB.ITEM_CODE IN
                                             (SELECT item_code
                                                FROM VIEW_SCRAP_LOSS_ITEM
                                               WHERE     SCRAP_ITEM_CODE =
                                                            a_recd_item_code
                                                     AND item_code IN
                                                            (SELECT item_code
                                                               FROM view_itemtran
                                                              WHERE     entity_code =
                                                                           a_entity_code
                                                                    AND div_code =
                                                                           a_div_code
                                                                    AND tcode = '0'
                                                                    AND tnature =
                                                                           'WJISS'
                                                                    AND vrno =
                                                                           NVL (
                                                                              a_issue_vrno,
                                                                              VRNO)))))
    Instead I'd make it EXISTS and then take those 2 queries and turn them into 1 query with view_scrap_loss_item and view_itemtran joined together.

  • Ways to speed up this query

    i was wondering if anyone has any ideas on how to speed this query up
    SELECT NAME, trunc (opr_date + opr_hour/24-numtodsinterval(1,'second'), 'DDD') AS opr_date, PRICE,
    Case OPR_HOUR When 0 THEN 24  ELSE OPR_HOUR END AS OPR_HOUR
    FROM ze_data.pjm_edf_lmp_hourly_int
    WHERE trunc (opr_date + opr_hour/24-numtodsinterval(1,'second'), 'DDD') between to_date ('2010/07/26', 'yyyy/mm/dd') and to_date ('2010/07/28', 'yyyy/mm/dd') and NAME in ('MISO')
    ORDER BY OPR_DATE desc, opr_hour descThe data is stored in the database with hours 0 to 23 this code take hour 0 and switches it to hour 24 of the the day before. I was wondering if there was a way to speed up the query as it takes 8 seconds to run
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

    Since you're comparing OPR_DATE to a date range, is there any need to add the time to OPR_DATE?
    Would this work better? An index on OPR_DATE might help, but wouldn't an index on NAME be even better?
    I don't know, just a guess. You haven't posted anything we can use.
    SELECT NAME
          ,trunc (opr_date + opr_hour/24-numtodsinterval(1,'second'), 'DDD') AS opr_date
          ,PRICE
          ,Case OPR_HOUR When 0 THEN 24  ELSE OPR_HOUR END AS OPR_HOUR
    FROM   ze_data.pjm_edf_lmp_hourly_int
    WHERE  opr_date >= to_date ('2010/07/26', 'yyyy/mm/dd')
    and    opr_date <= to_date ('2010/07/28', 'yyyy/mm/dd')
    and    NAME in ('MISO')
    ORDER  BY OPR_DATE desc, opr_hour desc;

  • Re: speeding up SPATIAL QUERY

    hi! ,
    Heres my sql statement ..
    Select ODPM2001_I From DFT.URBANAREAS U
    Where SDO_RELATE(U.GEOLOC, obTempPt, 'mask=CONTAINS querytype=WINDOW') = 'TRUE'; -- querytype=WINDOW
    I have put a spatial index on U.GEOLOC ....
    The sql statement takes too long
    I pose my challenge to you ..
    How can I speed up this query ?
    From the DBA side and/or the PL/SQL side ...
    thanks,
    Harish

    Hi,
    The first thing you should try is updating to the latest patch release. Often there are performance enhancements included.
    If you don't mind returning rectangles on whose boundary the point falls, use the anyinteract mask - it is the optimal mask to use if this situation allows it.
    Hope this helps.

  • How does XDB optimize XML Query?

    I found the query speed of XDB is much slower than Berkeley XML DB.
    How does XDB optimize XML Query?
    Are there any documents on this subject?
    And can XDB create indices on XMLType ( e.g. the index on element/attribute value and/or structure index)? if yes, how to do that?

    lezhou had a valid question and asked about:
    "I found the query speed of XDB is much slower than Berkeley XML DB"
    "How does XDB optimize XML Query?"
    These point to a "XML DB Concepts Guide", which does not yet exist.
    The procedures are explained, the methods are explained. If you enable event tracing as described in the XMLDB Developers Guide 10gR2, you will see statements in your trace file which will tell you more about the XML DB architecture (and therefor you can deduct performance impact) then the manual will reveal.
    An other example:
    The xdbconfig.xsd file is neatly explained - in regards of http-port-etc
    But not what the implecations are if you alter one of the other ones (the not explained parameters).
    If you know the architecture (GROUND LEVEL), you can give an correct answer to the initial question "I found the query speed of XDB is much slower than Berkeley XML DB. How does XDB optimize XML Query?"
    The balanced tree index is constructed the same way (on the same theory) in Oracle, DB2, but apparantly X is faster because in with the same buildup/architecture/databasestructure for both products, with the same data, with the same X --> value Y is beter constructed and delivers a better performance.
    apples = apples
    oracle xmldb = berkeley xmldb --> how can i test the o.apples=b.apples and that under these circumstances o.apples are faster ;-)
    THEREFOR:
    "I have to disagree a little bit...("It speaks about all these in detail").
    Still waiting for the XMLDB Concepts Guide / Administrators Guide / Performance Guide.

  • How to get physical SQL query

    Hi All,
    How to get the physical SQL query for the OBIEE reports.
    Thanks in advance,
    Haree.

    Hi Anitha,
    Thanks for your reply,
    I am getting XML script in log file. (Settings > Administration > Manage Sessions > View Log).
    How to get physical SQL query ?
    Thanks,
    Haree

Maybe you are looking for

  • Can no longer reply to any emails !?

    I am having a problem with Mail in that I can no longer reply to any email. Whenever I click reply I just get the spinning beach ball and then have to force quit Mail. This happens on any email I recieve ?? I can still download and send new emails ok

  • Purchase Order Change Restriction after MIGO and MIRO

    Hi Experts, I'd like to ask why Purchase Orders are allowed for change even when the Material Document and Invoice is already created under them, unlike the Sales Order in SD. Or is this some kind of configuration where I can configure the restrictio

  • How to insert more than 12 items using BDC for MB1C

    Hi, When we use LSMW for data transfer of MB1C transaction, more than 12 items can be  inserted in a document. But using BDC only 12 and below is possible, if the flat file system has more that 12 item, then the document is not created. How to insert

  • Live View not showing css or images.

    Hi Heres the issue: Images and css appear in Design View Images and CSS appears in Browser when I click view in browser Images and CSS dont appear in Live view (no css and question marks for images) Any ideas? I have previously built this into an and

  • Print GR/GI slip issue.

    Dear Experts, I am not able to print GR/GI slip during GR or GI (in MB1B and MIGO) I have maintained condition records in MN21. Still the problem exist. Print indicatiors are maintained for Movement types and T-codes in SPRO What could be missing ? P