application of SQL statement tuning

Application of SQL statement tuning

1 SQL: Code that never ends. 11 hours running, but nothing get inserted into tables

2. database version:
SELECT * FROM V$VERSION;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0    Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
3.
(i)
SQL> SHOW PARAMETER OPTIMIZER

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
optimizer_dynamic_sampling           integer     2
optimizer_features_enable            string      10.2.0.4
optimizer_index_caching              integer     0
optimizer_index_cost_adj             integer     100
optimizer_mode                       string      ALL_ROWS
optimizer_secure_view_merging        boolean     TRUE
SQL>
BIF
SQL> SHOW PARAMETER DB_FILE_MULTI

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_multiblock_read_count        integer     16
SQL>
(III)
SQL> SHOW PARAMETER DB_BLOCK_SIZE

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_block_size                        integer     8192
SQL>
(IV)
SQL> SHOW PARAMETER CURSOR_SHARING

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing                       string      EXACT
SQL>
4 calendar and Autotrace output
one)
SQL>
SQL> SET AUTOTRACE TRACEONLY
SQL> Query;


99999 rows selected.


Execution Plan
----------------------------------------------------------
Plan hash value: 888060805

--------------------------------------------------------------------------------

------

| Id  | Operation          | Name            | Rows  | Bytes | Cost (%CPU)| Time

     |

--------------------------------------------------------------------------------

------

|   0 | SELECT STATEMENT   |                 | 99999 |   171M|  6452   (1)| 00:0

1:18 |

|*  1 |  COUNT STOPKEY     |                 |       |       |            |
     |

|   2 |   TABLE ACCESS FULL| STGING| 99999 |   171M|  6452   (1)| 00:0

1:18 |

--------------------------------------------------------------------------------

------


Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter(ROWNUM<100000)


Statistics
----------------------------------------------------------
          8  recursive calls
          0  db block gets
      33379  consistent gets
      24108  physical reads
          0  redo size
  177773283  bytes sent via SQL*Net to client
      46901  bytes received via SQL*Net from client
       6668  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
      99999  rows processed
(b)
SQL> SET AUTOTRACE TRACEONLY EXPLAIN rem Could't do SET AUTOTRACE TRACEONLY as query takes a long time.
SQL> Query;

Execution Plan
----------------------------------------------------------
Plan hash value: 696991379

--------------------------------------------------------------------------------

-------------------------

| Id  | Operation                     | Name            | Rows  | Bytes |TempSpc

| Cost (%CPU)| Time     |

--------------------------------------------------------------------------------

-------------------------

|   0 | SELECT STATEMENT              |                 | 99999 |   171M|
| 77733   (1)| 00:15:33 |

|   1 |  HASH UNIQUE                  |                 | 99999 |   171M|   390M

| 77733   (1)| 00:15:33 |

|*  2 |   CONNECT BY WITHOUT FILTERING|                 |       |       |
|            |          |

|   3 |    VIEW                       |                 | 99999 |   171M|
| 40120   (1)| 00:08:02 |

|*  4 |     COUNT STOPKEY             |                 |       |       |
|            |          |

|   5 |      TABLE ACCESS FULL        | STG_OLD_RUBRIC1 |   621K|  1066M|
| 40120   (1)| 00:08:02 |

--------------------------------------------------------------------------------

-------------------------


Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter(LEVEL<=(LENGTH("STRING")-LENGTH(REPLACE("STRING",'

Criterion:')))/10

              )
   4 - filter(ROWNUM<100000)

SQL>
6. explain Plan output
SQL> ed
Wrote file afiedt.buf

  1  EXPLAIN PLAN SET STATEMENT_ID = 'A' FOR
  2  QUERY;
  3 /

Explained.


SQL> SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY);

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

Plan hash value: 696991379

--------------------------------------------------------------------------------

-------------------------

| Id  | Operation                     | Name            | Rows  | Bytes |TempSpc

| Cost (%CPU)| Time     |

--------------------------------------------------------------------------------

-------------------------


PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

|   0 | SELECT STATEMENT              |                 | 99999 |   171M|
| 77733   (1)| 00:15:33 |

|   1 |  HASH UNIQUE                  |                 | 99999 |   171M|   390M

| 77733   (1)| 00:15:33 |

|*  2 |   CONNECT BY WITHOUT FILTERING|                 |       |       |
|            |          |

|   3 |    VIEW                       |                 | 99999 |   171M|
| 40120   (1)| 00:08:02 |

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------


|*  4 |     COUNT STOPKEY             |                 |       |       |
|            |          |

|   5 |      TABLE ACCESS FULL        | STGING|   621K|  1066M|
| 40120   (1)| 00:08:02 |

--------------------------------------------------------------------------------

-------------------------



PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter(LEVEL<=(LENGTH("STRING")-LENGTH(REPLACE("STRING",'

Criterion:')))/10

              )
   4 - filter(ROWNUM<100000)

19 rows selected.

SQL>
7. from TKPROF output
SQL> alter session set timed_statistics = TRUE;

Session altered.

SQL> alter session set sql_trace = TRUE;

Session altered.

SQL> query; rem it is still running, no idea what is going on.
Any advice. Why the request is not able to generate a trace file and take so long?


Let me know, if needed further information.

Thank you.

Something like that...?

WITH T
AS
(SELECT 'Criterion: Crit1.
Proficient (points 2): Crit1 text.
Criterion: Crit2.
Basic (points 1): Crit2 text.
Criterion: Crit3.
Proficient (points 2): Crit3 text.
Criterion: Crit4.
Basic (points 1): Crit4 text.
Criterion: Crit5.
Proficient (points 2): Crit5 text.
Proficient (points 2): Crit5 text.
' latest_comment FROM DUAL union all SELECT 'Criterion: Crit1.
Proficient (points 2): Crit1 text.
Criterion: Crit2.
Basic (points 1): Crit2 text.
Criterion: Crit3.
Proficient (points 2): Crit3 text.
Criterion: Crit4.
Basic (points 1): Crit4 text.
Criterion: Crit5.
Proficient (points 2): Crit5 text.
Proficient (points 2): Crit5 text.
' latest_comment FROM DUAL union all SELECT 'Criterion: Crit1.
Proficient (points 2): Crit1 text.
Criterion: Crit2.
Basic (points 1): Crit2 text.
Criterion: Crit3.
Proficient (points 2): Crit3 text.
Criterion: Crit4.
Basic (points 1): Crit4 text.
Criterion: Crit5.
Proficient (points 2): Crit5 text.
Proficient (points 2): Crit5 text.
' latest_comment FROM DUAL ) SELECT SUBSTR(REGEXP_SUBSTR(latest_comment,'Criterion:[^<]+', 1, n.column_value), 20) column1, SUBSTR(REGEXP_SUBSTR(latest_comment,'points [^\)]+', 1, n.column_value), 8) column2, SUBSTR(REGEXP_SUBSTR(latest_comment,'\):[^<]+', 1, n.column_value), 3) column3, SUBSTR(REGEXP_SUBSTR(latest_comment,'blockquote>[^<]+', 1, n.column_value), 12) column4, SUBSTR(latest_comment, INSTR(latest_comment, '>', -1) + 1) column5 ,n.column_value FROM t,table(cast(multiset(select level from dual CONNECT BY LEVEL <= (LENGTH(latest_comment) - LENGTH(REPLACE(latest_comment, 'Criterion:')))/10) as sys.OdciNumberList)) n ;

Kind regards
Bob

Tags: Database

Similar Questions

  • Tuning sql of a product to the seller without changing the sql statement

    Hello

    We have a product of the provider that generates the SQL statement. For a query, we get the answer in 15 seconds. But users are asking if we can bring it back to 5 seconds. Limitation is the query can not be changed. He used about 10 to 12 tables and bit complex query.

    What kind of options could be evaluated if we are to improve the performance of a query (not sure if she could never be reduced to 5 seconds)
    without making any change to the query.

    Database Version: Oracle 10.2.0.4

    Thank you
    Delphine

    Hello

    http://www.Oracle-base.com/articles/10G/AutomaticSQLTuning10g.php

    your software is enterprise or standard?

    Tuning Pack & pack diagnosis are extra cost option with the standard edition.

    & the useful note * automatic SQL Tuning - SQL [271196.1 ID] profiles *.

    http://www.Oracle.com/us/corporate/pricing/technology-price-list-070617.PDF

    Thank you

    Published by: CKPT November 5, 2010 11:12

  • How to execute the SQL statement in the Application Module

    Hi people
    I´d would like to know how I can execute a SQL statement like "remove user" in the Module to request... prepareSession method...
    I m using Jdev 10 with ADF Faces
    Thank you

    This is possible, but you should think twice about it.
    If this can be done with an EO/VO do in this way.
    If you can't do it with an EO/VO you can yourself the DB operation (ApplicationModule.getDBTransaction ()) and use a call of createStatement (...) do what you want.

    Timo

  • SQL statements consume several times

    Hi all

    Recently I have faced the issue, 10 processes are taking place (means 10 sql statements) 4 declarations are huge time. For timebieng, I killed all sessions, but I know that's not just solve the problem. Can someone please explain briefly how to analyze the issue, root cause conclusion and giving if possible solutions for example please...

    What are the parameter that should be considered for the solution.


    Concerning

    KRISHNA

    Hello Krishna,

    The steps you need to take are explained in this thread:
    How to post a SQL tuning application HOW TO: post a request for tuning SQL - model poster statement

    In short:
    review the query plans, or ideally: trace/tkprof processes.
    After the output here, as well as your database version and optimizer parameter values.

  • Game of demand does not pick up the good period open to active fixed from the SQL statement

    Hello

    We have a demand that could kick off the simultaneous application of the value: Ixr: list of asset by period and Ixr: reserve book report.


    ON overall demand, we set the parameter: default period based on a SQL = select period_name from FA_DEPRN_PERIODS where book_type_code = 'PER2011' and period_close_date is null


    The query runs with the good period, until we open the new period, the game application will still come closed period.

    When I run this script on the database, it gives the correct name of the open period.


    Why all the demand does not pick up the open period?


    Rock


    Hello

    When planning, the parameter values that you gave when planning will not change.

    For the test, for a simultaneous program, I create a parameter and has given the value 100 tank and default type sql statement and the value as below.

    Select to_char (sysdate, 'dd-mon-yyyy hh24:mi:ss') of double

    If, at the time of the program, it shows a default value such as the date and time with seconds. Then I planned it for every minute.

    When you check in for each race it is seen the first time only, it does not.

    so in your case, you must plan its new after change of period.

    Hope this will help you...

  • What are these SQL statements?

    Hello!

    We are our applications running on Windows Server 2003 where it works fine, using Oracle via OCI 12.1.

    Now, we have the application installed on Windows Server 2012 and it works very slowly.

    When comparing these two environments trace files came a surprise: Oracle generates a lot of SQL statements when run on Windows Server 2012!  By operating on Windows2003 it only executes the SQL from the applicaton instructions.  These additional SQL statements must be the reason for the slowness, but why Oracle it generates them and how could we get arrested?

    An example:

    PARSING IN CURSOR #46985062096816 len = 210 dep = 2 uid = 0 oct = cover 3 = 0 tim = hv 1439277877325893 = ad 864012087 = "4db599f28" sqlid = "96g93hntrzjtr."

    Select / * + rule * / bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp #, sample_size, minimum, maximum, distcnt, lowval, hival, density, col #, spare1, spare2, hist_head avgcln $ where obj #=: 1 and intcol #=: 2

    END OF STMT

    ANALYSIS #46985062096816:c = 1000, e = 456, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 3, plh = 0, tim = 1439277877325890

    EXEC #46985062096816:c = 0, e = 498, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326455

    FETCH #46985062096816:c = 0, e = 56, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326533

    STAT #46985062096816 id = 1 cnt = 1 pid = 0 obj = op 411 = pos = 1 "TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr = 3 pr = 0 pw = time 0 = 55 US)"

    "STAT #46985062096816 id = 2 cnt = 1 pid = 1 pos = 1 obj = op 413 ='INDEX RANGE SCAN I_HH_OBJ #_INTCOL # (cr = 2 pr = 0 pw = time 0 = 32 US)"

    OUTCOME #46985062096816:c = 0, e = 37, dep = 2, type = 3, tim = 1439277877326601

    EXEC #46985062096816:c = 0, e = 23, p = 0, cr = 0, cu = 0, set = 0, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326702

    FETCH #46985062096816:c = 0, e = 18, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326738

    OUTCOME #46985062096816:c = 0, e = 8, dep = 2, type = 3, tim = 1439277877326765

    EXEC #46985062096816:c = 0, e = 19, p = 0, cr = 0, cu = 0, set = 0, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326837

    FETCH #46985062096816:c = 0, e = 21, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326923

    OUTCOME #46985062096816:c = 0, e = 10, dep = 2, type = 3, tim = 1439277877326954

    Thank you very much in advance!

    Best regards

    Jaakko Terhonen

    Thank you all for the reply!  This time, the reason was a problem in network traffic (TCP protocol): a lot of retransmissions for a still unknown reason.  If it had nothing to do with Oracle after all.

    I cried for help here because as a common application programmer, I wasn't familiar with the Interior details of SQL analysis and after seeing it in the trace, I assumed that these strange SQL statements - which, for some reason, is appeared only in W2012-trace - were the reason for the slowness.

    Thank you, I'm a little wiser now - and I hope that many others find this thread before asking the same question!

    Best regards

    Jaakko Terhonen

  • Copy SQL statement to another database with the same SQL_ID

    Is there a reliable way to copy a sql statement in a database to another preserving the formatting so it ends with the same SQL_ID.

    I want to copy a statement of the shared pool to a test database to develop a plan to import sql database in production.

    In the past, I just did ' select sql_fulltext from v$ sql "in SQL Developer and pasted the result into a spreadsheet SQL Developer and run it.   The statement is now in the pool shared with the correct sql_id.

    This does not work for instruction, I am currently in train.  It ends with a different id of sql.

    I know it's probably a problem of formatting, but the statement is 1000 characters and a manual check will take forever.

    You could put in a SQL Tuning Set and transfer it.

  • create a dynamic help based on a sql statement

    Hello

    A few years ago, I asked the same question, but I had no adequate answer to my problem:

    I have to build a text of dynamic help for items diaplayed (bubble help or better pop-up window). When I go to a header element there is a? Displays and when I click on the left mouse button it will be a constant display text. Now, I have a table with explanation (build on documentation in the table) for each column on each page. If I want to start an SQL statement when I click the button and the text should be displayed in the pop-up window.

    An example everywhere or can someone help me otherways?

    Concerning

    Siegwin

    fixed for you, the changes are:

    1. added onclick = "getItemHelpText('#CURRENT_ITEM_NAME#'); call to your model of 'Optional with Help' for all items using this model will have the same call in.
    2. adding the global page, page 0,
    3. moved JavaScript "getItemHelpText" on page 0 to become a global function, so you can use it anywhere in the application
    4. added item globle P0_DYNAMIC_HELP_TEXT page 0
    5. update your application process to set the value of P0_DYNAMIC_HELP_TEXT on the convening of AJAX, you must fix the help text.
    6. help text changed to P41_ENAME in & P0_DYNAMIC_HELP_TEXT.

    That's all I think, tested worked.

    good luck with the rest...

  • How to run a SQL statement to use a specific implementation plan

    Hi all

    I have a SQL that has recently been run badly. I tried the Advisor tuning SQL for the given SQL query and it gives the following information:

    GENERAL INFORMATION SECTION

    -------------------------------------------------------------------------------

    Name of the task of tuning: 2q94zb7djr2xn

    The owner task of tuning: LMDBPROD

    Type of work: single SQL statement

    County of execution: 2

    The current run: EXEC_8869

    Type of execution: TUNE SQL

    Scope: COMPLETE

    Time Limit (seconds): 60

    Status: COMPLETED

    Started on the: 03/02/2014-20:43:39

    To the: 03/02/2014 20:44:25

    -------------------------------------------------------------------------------

    Name of the schema: LMDBPROD

    SQL ID: 2q94zb7djr2xn

    SQL text: SELECT NPCOMMON. FGET_ACTION_CODE (ORDNUM) ACTIONCODE, STATUS,

    SUMA COUNT (*) FROM SORDER, WHERE HEADORDNUM IS NOT NULL AND

    NPCOMMON. FGET_PRODUCTOFFER4ORDER (ORDNUM) IN (SELECT ID FROM)

    PRODUCTOFFER WHERE PPSPECIFICATION_ID IN (SELECT ID FROM)

    PPSPECIFICATION WHERE PCLASS_CODE IN (SELECT PCLASS_CODE FROM)

    ARUSERGROUP WHERE CODE IN (SELECT ARUSERGROUP_CODE FROM)

    ARUSER_ARUSERGROUP WHERE ARUSER_USERNAME =: B1 AND STATUS = '1')

    AND STATUS = '1'))) GROUP BY NPCOMMON. FGET_ACTION_CODE (ORDNUM),

    STATUS

    -------------------------------------------------------------------------------

    RESULTS SECTION (1 result)

    -------------------------------------------------------------------------------

    1-alternative Plan conclusion

    ---------------------------

    Some implementation plans alternative for this statement was found by searching

    performance data in real-time and historical of the system.

    The following table lists these plans sorted by their average time.

    See "SECTION of ALTERNATIVE PLANS" section for detailed information on each

    plan.

    plan ID hash last visit elapsed note of origin (s)

    -- ---------- -------------------- ------------ --------------- ----------------

    1 617797893 2013-07-11/07: 45:20 9.555 no reproducible STS

    2 1311086720 2014-01-31/04: 00:44 19.569 AWR

    3 1226863820 2014-01-31/18: 00:24 AWR 21.158

    4 1359606848 2014-02-03/16: 00:34 21.492 AWR original plan

    The plan with hash 617797893 seems the most efficient one and is based on some specific SQL Tuning Set I ran on this time. But the note says that the plan is not reproducible. Is there anyway how can I force the SQL statement to execute the plan? The database version is Standard Edition 11.2.0.1.0

    Best regards

    Rodriguez

    Hello

    I think you can use this

    http://rnm1978.WordPress.com/2011/06/28/Oracle-11g-how-to-force-a-sql_id-to-use-a-plan_hash_value-using-SQL-baselines/

    before 11 g, we used to create an outline stored for this.

    concerning

  • SQL statement to filter with the value of State of Session

    Hello..
    I need to filter a SQL statement with an application retrieved from session state item value. I guess I could do this using a dynamic Action on a Page load event, but I don't know where to go from here. How could I add the filter to a report page existing SQL statement?

    Reference should / could be exactly like you reference page elements. I use the: variable_name format myself.

    If you are satisfied, please mark as answer.

    Best wishes,
    Howard

  • Capture the SQL statement before it runs

    Hello world

    I have a question about the capture of query sql statement in Oracle before he run? Is it possible to do and can give you the answer to this problem? Enter here means I can catch the declaration of all applications (like SQL, I * sqlplus or another application making the request to the database). I want to do this because my teacher asks me to analyze the request and if it violates any policy = > stop before Oracle run it.

    I tried this solution
    [Select trigger for Oracle | http://technology.amis.nl/2005/09/26/select-trigger-in-oracle-database-introducing-fine-grained-auditing/].
    but I think he looks not the answer. Because for the audit of the refined, the event handler is called when the first row is obtained. This is the average Oracle a analyze this quere and run to get the first row.

    Please help me with this problem

    Edited by: pirent420 at 04:05 06/05/2012

    Hello
    That's what you ask...

    www.Oracle.com/technetwork/Products/Database-Firewall/index.html

    Some other related things are:

    the database Vault control many things related to this in terms of what time of the day and access where data etc.

    Resource Manager can block statements if they want to use too many resources.

    The standard model of privilege/role/grant prevents access you something, that you are not allowed to see.

    Views can hide columns if necessary.

    DTV and RLS can hide lines

    It depends exactly on the requirement.

    See you soon,.
    Harry

  • "Balance forward" SQL statement

    Anyone developing a SQL statement which helps to carry forward balances? A UNION query might work?

    Here is my example where I need to join the 3 tables and display the results. According to data from the example below, I am looking for an application that allows me to illustrate that instances of Acrobat 9 software installed using 6 license capacity, or a balance of 4 which can be applied to Instances of installed software Acrobat 8.

    Table: LICENSE

    LICENSENUM SWLICENSE LICENSECAPACITY
    '1001' "adobe Acrobat 9' 10'

    Table: LICENSESW

    PRIORITY SWPRODUCT LICENSENUM
    "1001'"acrobat 9' 1".
    "1001'"acrobat 8' 2".

    Table: INSTALLEDSW

    INSTALLEDSW
    'Acrobat 9'
    'Acrobat 9'
    'Acrobat 9'
    'Acrobat 9'
    'Acrobat 9'
    'Acrobat 9'
    'Acrobat 8'
    'Acrobat 8'
    'Acrobat 8'
    'Acrobat 8'
    'Acrobat 8'


    I can write a select for total of charges, but this does not allow me to carry a balance forward to be applied on Acrobat 8 (priority 2).

    Select a LICENSE. SWLICENSE, LICENSE. LICENSECAPACITY County (INSTALLEDSW. INSTALLEDSW) as INSTALLED_COUNT
    license, LICENSESW, INSTALLEDSW
    where the LICENSE. LICENSENUM = LICENSESW. LICENSENUM
    AND LICENSESW. SWPRODUCT = INSTALLEDSW. INSTALLEDSW
    LICENSE group. SWLICENSE, LICENSE. LICENSECAPACITY;

    Results:
    SWLICENSE LICENSECAPACITY INSTALLED_COUNT
    "Adobe Acrobat 9' 11 ' 10' '.



    I need the results that look like this, where the balance of 4 is postponed after the first line:

    SWLICENSE LICENSECAPACITY INSTALLED_PRODUCT INSTALLED_COUNT
    "' Adobe Acrobat 9 6" "' Acrobat 6' 9" ""
    «' Adobe Acrobat 4' 9 "' Acrobat 8 5'"»

    Not easy to follow your example data, but if I show which, in my opinion, you are trying to achieve using the emp table, you can see if it helps...

    SQL> select deptno, empno, ename
      2        ,count(*) over (partition by deptno) as dept_count
      3        ,count(*) over (partition by deptno) - row_number() over (partition by deptno order by empno) as remaining
      4  from   emp
      5  order by deptno, empno;
    
        DEPTNO      EMPNO ENAME      DEPT_COUNT  REMAINING
    ---------- ---------- ---------- ---------- ----------
            10       7782 CLARK               3          2
            10       7839 KING                3          1
            10       7934 MILLER              3          0
            20       7369 SMITH               5          4
            20       7566 JONES               5          3
            20       7788 SCOTT               5          2
            20       7876 ADAMS               5          1
            20       7902 FORD                5          0
            30       7499 ALLEN               6          5
            30       7521 WARD                6          4
            30       7654 MARTIN              6          3
            30       7698 BLAKE               6          2
            30       7844 TURNER              6          1
            30       7900 JAMES               6          0
    
    14 rows selected.
    

    by using the count() and row_number() analytical functions (you can use others such as sum(), avg(), lag(), lead(), etc. as needed), you can make treatment that carries forward, backward or "groups" (aka partitions) data.

  • How to see all the sql on sql statements commands under 'history' link

    Hi all

    How to see the history of sql on sql commands tab.
    I want to see all the sql statements.
    Where we set if we need to store more sql statements in history.
    We use Apex3.2 and 10g (EE) database.

    Thank you
    Nr

    Is there a limitation to the Apex 3.2, there are only 200 files...

    Not sure about this, as I said earlier, the report is configured to display a maximum of 1,000 records, perhaps during the in-house data entry in the apex, she could to check something. In any case, all these are an internal feature and is not supposed to be "messed" with and could lead to no support.

    Your alternative uses the same method I proposed, and you can query manually (after granting dba) table of APEX_040000.wwv_flow_sw_sql_cmds or even do a report in your application with a csv export.

  • access SQL vs tuning question Advisor

    I am trying to understand a question which is:

    Which of the following identifies and creates an index to reduce the time of the DB for a given SQL statement?

    (a) SQL Tuning Advisor
    (b) SQL Access Advisor

    I think the right answer is a) tuning advisor, because it is for a given SQL statement and it can also be configured to automatically create an index when it runs over the extensible standard maintenance task. However, the marked answer is b) Access Advisor. That which is correct and why?

    Thank you!

    Waldrfm,

    I guess this question of OCP is also asking if STA or SAA make recommendations in terms of DB Time (%) or the cost of the workload (%).

    When you look at the details of STA recommendation, it is show recommendations by times of DB (which includes the DB service time + queue DB time) *, in particular for each SQL statement.

    However, when you look at the details of recommendation of SAA, is show the recommendations by improving Total cost (which is the cost of CBO, SUM (IO + CPU)). * instead of DB self time

    SQL statement.

    For example,.

    When you tune in 10 identified SQL statements using the STA, it tunes indivdual SQL statement acting time of each SQL DB.

    SAA tunes instructions SQL 10 identified as a workload making recommendations based on improving Total cost of the entire workload.

  • high - OEM - sql statement is accurate?

    Hi guys,.

    I have a high SQL statement on the page in the report of the addm base will blink from time to time.

    RECOMMENDATION 1: SQL Tuning, 14% of profit (1130 seconds)
    ACTION: run SQL Tuning Advisor on the SQL with SQL_ID
    + "fphtjnquzzpud." +
    RELEVANT OBJECT: SQL with SQL_ID fphtjnquzzpud statement and
    PLAN_HASH 799822736
    SELECT USER_ID FROM SUBSCRIBER WHERE USER_ID =: B1 AND ACTIVE_STATUS
    += 'ACTIVE' +.
    ACTION: examine the SQL with SQL_ID 'fphtjnquzzpud' for
    improvement of the performance possible.
    RELEVANT OBJECT: SQL with SQL_ID fphtjnquzzpud statement and
    PLAN_HASH 799822736
    SELECT USER_ID FROM SUBSCRIBER WHERE USER_ID =: B1 AND ACTIVE_STATUS
    += 'ACTIVE' +.
    Rationale: with SQL_ID 'fphtjnquzzpud' SQL statement executed
    + 38800468 times and had an average time elapsed seconds 0,000016. +
    RATIONALE: Average CPU used by execution was 0,000016 seconds.


    Now, I do not understand this rational, the average time will blink and time cpu is just 0.000016.
    How can this be an obstacle high performance SQL?
    the time will blink is high because it is run several times. That's all, but every time, it's just using 0.000016.


    so should I still tune?

    Kind regards
    Noob

    You may need to do something, the case is:

    SQL_ID "fphtjnquzzpud" was performed * 38,800,468 * times during the study period.

    38,800,468 time * 0,000016 seconds = 620.807488 seconds = 10 minutes, 21 seconds

    Maybe it's not the time it takes but rather the number of executions?

    Have you considered pinnig the table of SUBSCRIBER in the KEEP buffer pool?

    : p

Maybe you are looking for