How to learn sql query's execution time?
Hello All,
I am trying to find out the execution times of deterministic and non-deterministic function. Hence I have run following script and want to compare their execution times etc. Should I use v$sql? If so, which coloumns? Because I couln't find.
{code}
create table my_table
as
select mod(level,10)*10 col from dual connect by level <= 100 order by 1;
create or replace function my_det(giris number)
return number deterministic
is
num number;
begin
num :=giris*10;
return num;
end;
create or replace function my_func(giris number)
return number
is
num number;
begin
num :=giris*10;
return num;
end;
select my_det(col) from my_table; --First I want to run this query
select my_func(col) from my_table; --Then this query
{code}
What should I do in order to compare these two in terms of execution, fetch times, etc.?
Thanks in advance.
Hello NightWig
As you're on 11g, if you have queries that take more than a few seconds I'd definitely recommend looking at the real-time SQL monitor (assuming you're appropriately licensed). As the name suggests, it shows the progress of an SQL statement in real-time, breaking down how long each operation has taken with details of rows fetched so far. It also keeps details of recently executed queries for a short while so can see how your changes affect a statement.
Oracle SQL Monitoring documentation:http://docs.oracle.com/cd/E11882_01/server.112/e16638/instance_tune.htm#PFGRF94543
Thank you
Similar Messages
-
SQL Query + long execution time.
Dear Gurus/masters/All,
I request you all to help me in tuning the SQL query which is taking more time. DB Version : 10.2.0.4
SQL Query WHERE condition:
select column1, column2, .........
FROM
SIEBEL.S_ORG_EXT T1,
SIEBEL.S_PROD_INT T2,
SIEBEL.S_VOD T3,
SIEBEL.S_ORG_EXT T4,
SIEBEL.S_ORG_EXT T5,
SIEBEL.S_ORG_EXT_X T6,
SIEBEL.S_PROD_LN T7,
SIEBEL.S_ASSET_OM T8,
SIEBEL.S_VOD_VER T9,
SIEBEL.S_CTLG_CAT T10,
SIEBEL.S_CONTACT T11,
SIEBEL.S_PARTY T12,
SIEBEL.S_PARTY T13,
SIEBEL.S_PROD_INT T14,
SIEBEL.S_ASSET_BU T15,
SIEBEL.S_CTLG_CAT T16,
SIEBEL.S_ORG_EXT T17,
SIEBEL.S_ORG_EXT T18,
SIEBEL.S_ASSET T19,
SIEBEL.S_ADDR_PER T20,
SIEBEL.S_ORG_EXT T21,
SIEBEL.S_ASSET_X T22,
SIEBEL.S_ASSET T23
WHERE
T16.PAR_CAT_ID = T10.ROW_ID (+) AND
T14.CG_PR_CTLG_CAT_ID = T16.ROW_ID (+) AND
T3.ROW_ID = T9.VOD_ID AND
T14.CFG_MODEL_ID = T3.OBJECT_NUM AND
T23.OWNER_CON_ID = T11.ROW_ID (+) AND
T23.OWNER_ACCNT_ID = T6.PAR_ROW_ID (+) AND
T23.PER_ADDR_ID = T20.ROW_ID (+) AND
T23.PROD_ID = T14.ROW_ID AND
T23.OWNER_ACCNT_ID = T21.PAR_ROW_ID (+) AND
T14.PR_PROD_LN_ID = T7.ROW_ID (+) AND
T23.ROOT_ASSET_ID = T19.ROW_ID (+) AND
T19.PROD_ID = T2.ROW_ID (+) AND
T23.BILL_ACCNT_ID = T18.PAR_ROW_ID (+) AND
T23.RTNG_DLR_ID = T1.PAR_ROW_ID (+) AND
T23.PREF_SRV_DLR_ID = T17.PAR_ROW_ID (+) AND
T23.DLR_ID = T4.PAR_ROW_ID (+) AND
T23.ROW_ID = T22.PAR_ROW_ID (+) AND
T23.ROW_ID = T8.PAR_ROW_ID (+) AND
T23.PR_CON_ID = T12.ROW_ID (+) AND
T23.BU_ID = T15.BU_ID (+) AND T23.ROW_ID = T15.ASSET_ID (+) AND
T15.BU_ID = T13.ROW_ID (+) AND
T15.BU_ID = T5.PAR_ROW_ID (+) AND
((T23.SERIAL_NUM IS NOT NULL AND T23.PAR_ASSET_ID IS NULL OR T23.X_PHONE_NUMBER IS NOT NULL AND T23.PAR_ASSET_ID IS NOT NULL) AND
(T9.VER_NUM = :1));Query Exection Plan:
PLAN_TABLE_OUTPUT
Plan hash value: 967177145
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 54117 | 92M| 4435K (1)| 01:58:43 |
| 1 | NESTED LOOPS OUTER | | 54117 | 92M| 4435K (1)| 01:58:43 |
| 2 | NESTED LOOPS OUTER | | 54117 | 87M| 4261K (1)| 01:54:04 |
| 3 | NESTED LOOPS OUTER | | 54117 | 86M| 4154K (1)| 01:51:13 |
| 4 | NESTED LOOPS OUTER | | 54117 | 85M| 4111K (1)| 01:50:03 |
| 5 | NESTED LOOPS OUTER | | 54117 | 84M| 3980K (1)| 01:46:33 |
| 6 | NESTED LOOPS OUTER | | 54117 | 83M| 3937K (1)| 01:45:24 |
| 7 | NESTED LOOPS OUTER | | 54117 | 81M| 3763K (1)| 01:40:44 |
| 8 | NESTED LOOPS OUTER | | 54117 | 81M| 3751K (1)| 01:40:25 |
| 9 | NESTED LOOPS OUTER | | 54117 | 80M| 3621K (1)| 01:36:57 |
| 10 | NESTED LOOPS OUTER | | 54117 | 73M| 3515K (1)| 01:34:07 |
| 11 | NESTED LOOPS OUTER | | 54117 | 71M| 3410K (1)| 01:31:18 |
| 12 | NESTED LOOPS OUTER | | 54117 | 69M| 3410K (1)| 01:31:18 |
| 13 | NESTED LOOPS OUTER | | 54117 | 67M| 3410K (1)| 01:31:18 |
| 14 | NESTED LOOPS OUTER | | 54117 | 66M| 3410K (1)| 01:31:18 |
| 15 | NESTED LOOPS OUTER | | 54117 | 64M| 3324K (1)| 01:28:59 |
| 16 | NESTED LOOPS OUTER | | 54117 | 62M| 3237K (1)| 01:26:40 |
| 17 | NESTED LOOPS | | 54117 | 57M| 3106K (1)| 01:23:10 |
| 18 | NESTED LOOPS OUTER | | 71 | 43665 | 381 (2)| 00:00:01 |
| 19 | NESTED LOOPS OUTER | | 71 | 42316 | 323 (2)| 00:00:01 |
| 20 | NESTED LOOPS OUTER | | 71 | 41322 | 322 (2)| 00:00:01 |
| 21 | NESTED LOOPS | | 71 | 24708 | 265 (3)| 00:00:01 |
| 22 | NESTED LOOPS | | 77 | 2772 | 141 (4)| 00:00:01 |
|* 23 | TABLE ACCESS FULL | S_VOD_VER | 75 | 1350 | 72 (7)| 00:00:01 |
| 24 | TABLE ACCESS BY INDEX ROWID| S_VOD | 1 | 18 | 1 (0)| 00:00:01 |
|* 25 | INDEX UNIQUE SCAN | S_VOD_P1 | 1 | | 1 (0)| 00:00:01 |
| 26 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 312 | 2 (0)| 00:00:01 |
|* 27 | INDEX RANGE SCAN | S_PROD_INT_F9 | 1 | | 1 (0)| 00:00:01 |
| 28 | TABLE ACCESS BY INDEX ROWID | S_PROD_LN | 1 | 234 | 1 (0)| 00:00:01 |
|* 29 | INDEX UNIQUE SCAN | S_PROD_LN_P1 | 1 | | 1 (0)| 00:00:01 |
| 30 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 1 | 14 | 1 (0)| 00:00:01 |
|* 31 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 1 | | 1 (0)| 00:00:01 |
| 32 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 1 | 19 | 1 (0)| 00:00:01 |
|* 33 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 1 | | 1 (0)| 00:00:01 |
|* 34 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 760 | 375K| 43753 (1)| 00:01:11 |
|* 35 | INDEX RANGE SCAN | S_ASSET_U2 | 55873 | | 312 (3)| 00:00:01 |
| 36 | TABLE ACCESS BY INDEX ROWID | S_ASSET_OM | 1 | 94 | 2 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN | S_ASSET_OM_U1 | 1 | | 2 (0)| 00:00:01 |
| 38 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 1 | 39 | 2 (0)| 00:00:01 |
|* 39 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 1 | | 1 (0)| 00:00:01 |
| 40 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1 | 29 | 2 (0)| 00:00:01 |
|* 41 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | 1 (0)| 00:00:01 |
| 42 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 |
|* 43 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
| 44 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
| 46 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 |
|* 47 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
| 48 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 36 | 2 (0)| 00:00:01 |
|* 49 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
| 50 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 139 | 2 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
| 52 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 1 | 16 | 2 (0)| 00:00:01 |
|* 53 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 1 | | 2 (0)| 00:00:01 |
|* 54 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | 1 (0)| 00:00:01 |
| 55 | TABLE ACCESS BY INDEX ROWID | S_ASSET_BU | 1 | 34 | 3 (0)| 00:00:01 |
|* 56 | INDEX RANGE SCAN | S_ASSET_BU_U1 | 1 | | 2 (0)| 00:00:01 |
|* 57 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | 1 (0)| 00:00:01 |
| 58 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 1 | 37 | 2 (0)| 00:00:01 |
|* 59 | INDEX UNIQUE SCAN | S_ASSET_P1 | 1 | | 2 (0)| 00:00:01 |
| 60 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 16 | 1 (0)| 00:00:01 |
|* 61 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 1 | | 1 (0)| 00:00:01 |
| 62 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 14 | 2 (0)| 00:00:01 |
|* 63 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
| 64 | TABLE ACCESS BY INDEX ROWID | S_ASSET_X | 1 | 93 | 3 (0)| 00:00:01 |
|* 65 | INDEX RANGE SCAN | S_ASSET_X_U1 | 1 | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
23 - filter("T9"."VER_NUM"=TO_NUMBER(:1))
25 - access("T3"."ROW_ID"="T9"."VOD_ID")
27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID"(+))
31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID"(+))
33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID"(+))
34 - filter("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL OR "T23"."X_PHONE_NUMBER" IS
NOT NULL AND "T23"."PAR_ASSET_ID" IS NOT NULL)
35 - access("T23"."PROD_ID"="T14"."ROW_ID")
37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID"(+))
39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID"(+))
41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID"(+))
43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID"(+))
45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID"(+))
47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID"(+))
49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID"(+))
51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID"(+))
53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID"(+))
54 - access("T23"."PR_CON_ID"="T12"."ROW_ID"(+))
56 - access("T23"."ROW_ID"="T15"."ASSET_ID"(+) AND "T23"."BU_ID"="T15"."BU_ID"(+))
57 - access("T15"."BU_ID"="T13"."ROW_ID"(+))
59 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID"(+))
61 - access("T19"."PROD_ID"="T2"."ROW_ID"(+))
63 - access("T15"."BU_ID"="T5"."PAR_ROW_ID"(+))
65 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID"(+))
Note
- dynamic sampling used for this statement
105 rows selected.out put of dbms_xplan.display_cursor :
SQL> select * from table(dbms_xplan.display_cursor('xxxxxxxxxxxxxx',NULL,'iostats last'));
PLAN_TABLE_OUTPUT
SQL_ID xxxxxxxxxxxxxx, child number 0
SELECT T23.CONFLICT_ID, T23.LAST_UPD, T23.CREATED, T23.LAST_UPD_BY, T23.CREATED_BY,
T23.MODIFICATION_NUM, T23.ROW_ID, T23.ASSET_NUM, T21.LOC, T21.NAME, T23.INSTALL_DT,
T23.INVLOC_ID, T23.NAME, T23.OU_ADDR_ID, T23.OWNER_ACCNT_ID, T23.PAR_ASSET_ID, T23.PER_ADDR_ID,
T20.STATE, T23.PR_CON_ID, T23.PR_EMP_ID, T14.DESC_TEXT, T23.PROD_ID, T14.NAME,
T21.INTEGRATION_ID, T23.COST_LST_ID, T14.SERIALIZED_FLG, T23.REGISTERED_DT, T23.SERIAL_NUM,
T23.VERSION, T23.STATUS_CD, T14.PR_PROD_LN_ID, T7.NAME, T23.QTY, T23.ASSET_COND_CD,
T23.PR_ACCNT_ID, T23.OWNERSHIP_TYPE_CD, T23.XA_CLASS_ID, T23.OPER_STATUS_CD, T23.SP_NUM,
T23.BILL_ACCNT_ID, T23.SERV_ACCT_ID, T9.RELEASED_FLG, T23.CFG_TYPE_CD, T9.VER_NUM, T23.END_DT,
T23.ASSEMBLY_PORT_ID,
Plan hash value: xxxxxxxxxxxxxx
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
| 1 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:23:58.99 | 1236K| 460K|
| 2 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:23:58.99 | 1236K| 460K|
| 3 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:23:58.85 | 1236K| 460K|
| 4 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:23:58.69 | 1236K| 460K|
| 5 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:23:58.69 | 1236K| 460K|
| 6 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:23:58.69 | 1236K| 460K|
| 7 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.47 | 1236K| 460K|
| 8 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.47 | 1236K| 460K|
| 9 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.37 | 1236K| 460K|
| 10 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.22 | 1236K| 460K|
| 11 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.16 | 1236K| 460K|
| 12 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.16 | 1236K| 460K|
| 13 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.16 | 1236K| 460K|
| 14 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.16 | 1236K| 460K|
| 15 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:58.09 | 1236K| 460K|
| 16 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:23:57.99 | 1236K| 460K|
| 17 | NESTED LOOPS | | 1 | 11 | 10 |00:23:57.98 | 1236K| 460K|
| 18 | NESTED LOOPS OUTER | | 1 | 1 | 57 |00:00:00.02 | 828 | 0 |
| 19 | NESTED LOOPS OUTER | | 1 | 2 | 57 |00:00:00.02 | 828 | 0 |
| 20 | NESTED LOOPS OUTER | | 1 | 2 | 57 |00:00:00.02 | 828 | 0 |
| 21 | NESTED LOOPS | | 1 | 2 | 57 |00:00:00.01 | 786 | 0 |
| 22 | NESTED LOOPS | | 1 | 2 | 232 |00:00:00.01 | 493 | 0 |
|* 23 | TABLE ACCESS FULL | S_VOD_VER | 1 | 75 | 246 |00:00:00.01 | 12 | 0 |
| 24 | TABLE ACCESS BY INDEX ROWID| S_VOD | 246 | 1 | 232 |00:00:00.01 | 481 | 0 |
|* 25 | INDEX UNIQUE SCAN | S_VOD_P1 | 246 | 1 | 232 |00:00:00.01 | 249 | 0 |
| 26 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 232 | 1 | 57 |00:00:00.01 | 293 | 0 |
|* 27 | INDEX RANGE SCAN | S_PROD_INT_F9 | 232 | 1 | 57 |00:00:00.01 | 236 | 0 |
| 28 | TABLE ACCESS BY INDEX ROWID | S_PROD_LN | 57 | 1 | 39 |00:00:00.01 | 42 | 0 |
|* 29 | INDEX UNIQUE SCAN | S_PROD_LN_P1 | 57 | 1 | 39 |00:00:00.01 | 3 | 0 |
| 30 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 31 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 32 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 33 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 34 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 57 | 10 | 10 |00:23:57.97 | 1235K| 460K|
|* 35 | INDEX RANGE SCAN | S_ASSET_U2 | 57 | 734 | 627K|00:00:01.34 | 4295 | 2032 |
| 36 | TABLE ACCESS BY INDEX ROWID | S_ASSET_OM | 10 | 1 | 0 |00:00:00.01 | 26 | 2 |
|* 37 | INDEX RANGE SCAN | S_ASSET_OM_U1 | 10 | 1 | 0 |00:00:00.01 | 26 | 2 |
| 38 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 10 | 1 | 10 |00:00:00.11 | 36 | 12 |
|* 39 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 10 | 1 | 10 |00:00:00.06 | 26 | 6 |
| 40 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 10 | 1 | 10 |00:00:00.07 | 36 | 18 |
|* 41 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 10 | 1 | 10 |00:00:00.04 | 26 | 8 |
| 42 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 43 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 44 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 45 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 46 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 47 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 48 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 10 |00:00:00.05 | 46 | 12 |
|* 49 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 10 |00:00:00.03 | 26 | 6 |
| 50 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 10 |00:00:00.15 | 55 | 23 |
|* 51 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 10 |00:00:00.04 | 26 | 6 |
| 52 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 10 | 1 | 10 |00:00:00.10 | 40 | 12 |
|* 53 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 10 | 1 | 10 |00:00:00.05 | 30 | 6 |
|* 54 | INDEX UNIQUE SCAN | S_PARTY_P1 | 10 | 1 | 0 |00:00:00.01 | 5 | 0 |
| 55 | TABLE ACCESS BY INDEX ROWID | S_ASSET_BU | 10 | 1 | 10 |00:00:00.22 | 50 | 29 |
|* 56 | INDEX RANGE SCAN | S_ASSET_BU_U1 | 10 | 1 | 10 |00:00:00.15 | 40 | 19 |
| 57 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 10 |00:00:00.01 | 36 | 0 |
|* 58 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 10 |00:00:00.01 | 26 | 0 |
|* 59 | INDEX UNIQUE SCAN | S_PARTY_P1 | 10 | 1 | 10 |00:00:00.01 | 26 | 0 |
| 60 | TABLE ACCESS BY INDEX ROWID | S_ASSET_X | 10 | 1 | 10 |00:00:00.16 | 50 | 20 |
|* 61 | INDEX RANGE SCAN | S_ASSET_X_U1 | 10 | 1 | 10 |00:00:00.09 | 40 | 10 |
| 62 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 10 | 1 | 10 |00:00:00.14 | 46 | 19 |
|* 63 | INDEX UNIQUE SCAN | S_ASSET_P1 | 10 | 1 | 10 |00:00:00.04 | 36 | 9 |
| 64 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 10 | 1 | 10 |00:00:00.01 | 26 | 0 |
|* 65 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 10 | 1 | 10 |00:00:00.01 | 16 | 0 |
Predicate Information (identified by operation id):
23 - filter("T9"."VER_NUM"=:1)
25 - access("T3"."ROW_ID"="T9"."VOD_ID")
27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID")
31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID")
33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID")
34 - filter((("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL) OR ("T23"."X_PHONE_NUMBER" IS NOT NULL AND
"T23"."PAR_ASSET_ID" IS NOT NULL)))
35 - access("T23"."PROD_ID"="T14"."ROW_ID")
37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID")
39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID")
41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID")
43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID")
45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID")
47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID")
49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID")
51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID")
53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID")
54 - access("T23"."PR_CON_ID"="T12"."ROW_ID")
56 - access("T23"."ROW_ID"="T15"."ASSET_ID" AND "T23"."BU_ID"="T15"."BU_ID")
58 - access("T15"."BU_ID"="T5"."PAR_ROW_ID")
59 - access("T15"."BU_ID"="T13"."ROW_ID")
61 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID")
63 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID")
65 - access("T19"."PROD_ID"="T2"."ROW_ID")
SQL_ID xxxxxxxxxxxxxx, child number 1
SELECT T23.CONFLICT_ID, T23.LAST_UPD, T23.CREATED, T23.LAST_UPD_BY, T23.CREATED_BY,
T23.MODIFICATION_NUM, T23.ROW_ID, T23.ASSET_NUM, T21.LOC, T21.NAME, T23.INSTALL_DT,
T23.INVLOC_ID, T23.NAME, T23.OU_ADDR_ID, T23.OWNER_ACCNT_ID, T23.PAR_ASSET_ID, T23.PER_ADDR_ID,
T20.STATE, T23.PR_CON_ID, T23.PR_EMP_ID, T14.DESC_TEXT, T23.PROD_ID, T14.NAME,
T21.INTEGRATION_ID, T23.COST_LST_ID, T14.SERIALIZED_FLG, T23.REGISTERED_DT, T23.SERIAL_NUM,
T23.VERSION, T23.STATUS_CD, T14.PR_PROD_LN_ID, T7.NAME, T23.QTY, T23.ASSET_COND_CD,
T23.PR_ACCNT_ID, T23.OWNERSHIP_TYPE_CD, T23.XA_CLASS_ID, T23.OPER_STATUS_CD, T23.SP_NUM,
T23.BILL_ACCNT_ID, T23.SERV_ACCT_ID, T9.RELEASED_FLG, T23.CFG_TYPE_CD, T9.VER_NUM, T23.END_DT,
T23.ASSEMBLY_PORT_ID,
Plan hash value: xxxxxxxxxxxxxx
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
| 1 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:28:15.04 | 1237K| 512K|
| 2 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:28:15.04 | 1237K| 512K|
| 3 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:28:14.92 | 1237K| 512K|
| 4 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:28:14.82 | 1237K| 512K|
| 5 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:28:14.82 | 1237K| 512K|
| 6 | NESTED LOOPS OUTER | | 1 | 10 | 10 |00:28:14.82 | 1237K| 512K|
| 7 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.64 | 1237K| 512K|
| 8 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.63 | 1237K| 512K|
| 9 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.51 | 1237K| 512K|
| 10 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.42 | 1237K| 512K|
| 11 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.33 | 1236K| 512K|
| 12 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.33 | 1236K| 512K|
| 13 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.33 | 1236K| 512K|
| 14 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.33 | 1236K| 512K|
| 15 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.23 | 1236K| 512K|
| 16 | NESTED LOOPS OUTER | | 1 | 11 | 10 |00:28:14.12 | 1236K| 512K|
| 17 | NESTED LOOPS | | 1 | 11 | 10 |00:28:14.12 | 1236K| 512K|
| 18 | NESTED LOOPS OUTER | | 1 | 1 | 57 |00:00:00.02 | 828 | 0 |
| 19 | NESTED LOOPS OUTER | | 1 | 1 | 57 |00:00:00.02 | 828 | 0 |
| 20 | NESTED LOOPS OUTER | | 1 | 1 | 57 |00:00:00.01 | 828 | 0 |
| 21 | NESTED LOOPS | | 1 | 1 | 57 |00:00:00.01 | 786 | 0 |
| 22 | NESTED LOOPS | | 1 | 2 | 232 |00:00:00.01 | 493 | 0 |
|* 23 | TABLE ACCESS FULL | S_VOD_VER | 1 | 74 | 246 |00:00:00.01 | 12 | 0 |
| 24 | TABLE ACCESS BY INDEX ROWID| S_VOD | 246 | 1 | 232 |00:00:00.01 | 481 | 0 |
|* 25 | INDEX UNIQUE SCAN | S_VOD_P1 | 246 | 1 | 232 |00:00:00.01 | 249 | 0 |
| 26 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 232 | 1 | 57 |00:00:00.01 | 293 | 0 |
|* 27 | INDEX RANGE SCAN | S_PROD_INT_F9 | 232 | 1 | 57 |00:00:00.01 | 236 | 0 |
| 28 | TABLE ACCESS BY INDEX ROWID | S_PROD_LN | 57 | 1 | 39 |00:00:00.01 | 42 | 0 |
|* 29 | INDEX UNIQUE SCAN | S_PROD_LN_P1 | 57 | 1 | 39 |00:00:00.01 | 3 | 0 |
| 30 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 31 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 32 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 33 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 57 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 34 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 57 | 10 | 10 |00:28:14.10 | 1236K| 512K|
|* 35 | INDEX RANGE SCAN | S_ASSET_U2 | 57 | 734 | 627K|00:00:01.26 | 4299 | 3327 |
| 36 | TABLE ACCESS BY INDEX ROWID | S_ASSET_OM | 10 | 1 | 0 |00:00:00.01 | 26 | 2 |
|* 37 | INDEX RANGE SCAN | S_ASSET_OM_U1 | 10 | 1 | 0 |00:00:00.01 | 26 | 2 |
| 38 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 10 | 1 | 10 |00:00:00.10 | 36 | 18 |
|* 39 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 10 | 1 | 10 |00:00:00.04 | 26 | 9 |
| 40 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 10 | 1 | 10 |00:00:00.11 | 36 | 20 |
|* 41 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 10 | 1 | 10 |00:00:00.04 | 26 | 10 |
| 42 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 43 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 44 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 45 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 46 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
|* 47 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 0 |00:00:00.01 | 0 | 0 |
| 48 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 10 |00:00:00.09 | 46 | 18 |
|* 49 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 10 |00:00:00.05 | 26 | 9 |
| 50 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 10 |00:00:00.09 | 55 | 32 |
|* 51 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 10 |00:00:00.02 | 26 | 8 |
| 52 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 10 | 1 | 10 |00:00:00.13 | 40 | 18 |
|* 53 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 10 | 1 | 10 |00:00:00.06 | 30 | 9 |
|* 54 | INDEX UNIQUE SCAN | S_PARTY_P1 | 10 | 1 | 0 |00:00:00.01 | 5 | 0 |
| 55 | TABLE ACCESS BY INDEX ROWID | S_ASSET_BU | 10 | 1 | 10 |00:00:00.18 | 50 | 29 |
|* 56 | INDEX RANGE SCAN | S_ASSET_BU_U1 | 10 | 1 | 10 |00:00:00.11 | 40 | 19 |
| 57 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 10 | 1 | 10 |00:00:00.01 | 36 | 0 |
|* 58 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 10 | 1 | 10 |00:00:00.01 | 26 | 0 |
|* 59 | INDEX UNIQUE SCAN | S_PARTY_P1 | 10 | 1 | 10 |00:00:00.01 | 26 | 0 |
| 60 | TABLE ACCESS BY INDEX ROWID | S_ASSET_X | 10 | 1 | 10 |00:00:00.10 | 50 | 20 |
|* 61 | INDEX RANGE SCAN | S_ASSET_X_U1 | 10 | 1 | 10 |00:00:00.03 | 40 | 10 |
| 62 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 10 | 1 | 10 |00:00:00.12 | 46 | 20 |
|* 63 | INDEX UNIQUE SCAN | S_ASSET_P1 | 10 | 1 | 10 |00:00:00.06 | 36 | 10 |
| 64 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 10 | 1 | 10 |00:00:00.01 | 26 | 0 |
|* 65 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 10 | 1 | 10 |00:00:00.01 | 16 | 0 |
Predicate Information (identified by operation id):
23 - filter("T9"."VER_NUM"=:1)
25 - access("T3"."ROW_ID"="T9"."VOD_ID")
27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID")
31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID")
33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID")
34 - filter((("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL) OR ("T23"."X_PHONE_NUMBER" IS NOT NULL AND
"T23"."PAR_ASSET_ID" IS NOT NULL)))
35 - access("T23"."PROD_ID"="T14"."ROW_ID")
37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID")
39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID")
41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID")
43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID")
45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID")
47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID")
49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID")
51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID")
53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID")
54 - access("T23"."PR_CON_ID"="T12"."ROW_ID")
56 - access("T23"."ROW_ID"="T15"."ASSET_ID" AND "T23"."BU_ID"="T15"."BU_ID")
58 - access("T15"."BU_ID"="T5"."PAR_ROW_ID")
59 - access("T15"."BU_ID"="T13"."ROW_ID")
61 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID")
63 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID")
65 - access("T19"."PROD_ID"="T2"."ROW_ID")
226 rows selected.
SQL > -
Hi all...
How does a SQL query basically work? Is there any pseudocode for it?
How ro calculate the cost of query?
Can we find out what would be the execution time for a query before it is executed?
Thanks in advance.
AmeyaHi Avinash,
Look closely mate!!!
You have done set autotrace on... meaning you are executing the statement while i am doing set autotrace traceonly explain meaning the statement would never get executed actually.. oracle optimizer will just select the desired plan and will show the output..
You can even ESTIMATE how many rows the qeury will return before even executing the statement using the same above tech.. i will show you how:
The explain plan gives this -- as long as you are using the CBO (cost based
optimizer). Doesn't matter if you have 1 or 50 tables. The last part of the
plan is the estimate output.
consider:
SQL> set autotrace traceonly explain
SQL> select e1.*, e2.* from emp e1, emp e2;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=15 Card=196 Bytes=12544)
1 0 MERGE JOIN (CARTESIAN) (Cost=15 Card=196 Bytes=12544)
2 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448)
3 1 SORT (JOIN) (Cost=14 Card=14 Bytes=448)
4 3 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448)
196 = 14 * 14 -- thats right....
SQL> select emp.ename, mgr.ename from
2 emp, emp mgr
3 where emp.mgr = mgr.empno;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=13 Bytes=208)
1 0 MERGE JOIN (Cost=5 Card=13 Bytes=208)
2 1 SORT (JOIN) (Cost=3 Card=14 Bytes=112)
3 2 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=112)
4 1 SORT (JOIN) (Cost=3 Card=14 Bytes=112)
5 4 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=112)
Here is estimated that about 13 rows would be returned...
SQL> select count(*) from emp;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1)
1 0 SORT (AGGREGATE)
2 1 INDEX (FULL SCAN) OF 'EMP_PK' (UNIQUE) (Cost=1 Card=14)
one row...
SQL> select ename, dname
2 from emp, dept where emp.deptno = dept.deptno;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=14 Bytes=252)
1 0 NESTED LOOPS (Cost=5 Card=14 Bytes=252)
2 1 TABLE ACCESS (FULL) OF 'DEPT' (Cost=1 Card=4 Bytes=44)
3 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=98)
14 rows...
1 select ename, dname
2* from emp, dept where emp.deptno = dept.deptno and emp.ename like '%A%'
SQL> /
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=18)
1 0 NESTED LOOPS (Cost=2 Card=1 Bytes=18)
2 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=1 Bytes=7)
3 1 TABLE ACCESS (BY INDEX ROWID) OF 'DEPT' (Cost=1 Card=4 Bytes=44)
4 3 INDEX (RANGE SCAN) OF 'DEPT_IDX' (NON-UNIQUE)
1 rows.....
and this was all done without executing the query. See EXPLAIN plan and the
PLAN_TABLE. -
How can i check the procedure execution time..?
Hi All,
Can any one of you tell me how can i check the procedure execution time..?
Thanks in advance.if running it from SQL*Plus,
SQL> set timing on
Or from PL/SQL, use DBMS_UTILITY.GET_TIME before and after the call and calclate the difference. -
Size of SQL query before execution and after execution
hi all
I need help on how can i find out the size of SQL query before execution and after execution in java
The query can be any query select / insert / update
Can anyone help me if any system tables help to find out the required size i mentioned
Urgent help is required
Thanking in advanceI need the size in terms of bytes
like the rquirement is stated as below
select ................: 10 B , return 250 B
so i need size before and after execution in terms of bytes -
How to use sql query in java ?
i don't know how to use sql query in java code.
who can give me some advice?
thankshttp://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/
-
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
-
How to execute SQL Query in Code behind Using infopath 2010?
Hi,
I've repeatable on infopath form, and want bind it throuth code behind from SQL table. My question is that how to execute SQL Query in code behind from infopath as well as how would get Query result to bind repeatable control?
Thanks In Advance
Shoeb AhmadHello,
You first need to add new SQL DB connection then you need execute connection from code behind.
See below link to create new connection
http://office.microsoft.com/en-in/infopath-help/add-a-data-connection-to-a-microsoft-sql-server-database-HP010092823.aspx:
http://www.bizsupportonline.net/infopath2010/connect-infopath-2010-sql-server-2008-table.htm
Then use below code to execute this connection:
AdoQueryConnection conn = (AdoQueryConnection)(this.DataConnections["Data connection name"]);
string origCommand = Select * from tablename;
conn.Command = origCommand;
conn.Execute();
Finally bind your table:
http://www.bizsupportonline.net/infopath2007/4-way-programmatically-add-row-repeating-table.htm
http://stevemannspath.blogspot.in/2010/09/infopath-20072010-populate-repeating.html
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
How to write sql query with many parameter in ireport
hai,
i'm a new user in ireport.how to write sql query with many parameters in ireport's report query?i already know to create a parameter like(select * from payment where entity=$P{entity}.
but i don't know to create query if more than 1 parameter.i also have parameter such as
$P{entity},$P{id},$P{ic}.please help me for this.
thanksYou are in the wrong place. The ireport support forum may be found here
http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=showcat&catid=9 -
SQL Query Executing longer time
Hi , The below SQL query executing longer time . Please help to Improve the query performance. The query continuously running for more than 24 hours and failing with roolback segment error. Not getting the final output. Most of the tables are having milions of records.
Select distinct
IBS.ADSL_ACCESS_INFO,
IBS.LIJ ,
regexp_substr(OBVS.REFERENTIE_A,'[[:digit:]]+') as O_NUMBER,
DBS.CKR_NUMMER_CONTRACTANT,
DBS.DNUMBER
FROM CD.IBS,
CD.OIBL,
CD.IH,
CD.ODL,
CD.OH,
CD.DBS,
CD.OBVS
Where IBS.END_DT = To_Date('31129999', 'ddmmyyyy')
AND OIBL.END_DT = to_date('31129999', 'ddmmyyyy')
AND DBS.END_DT = to_date('31129999', 'ddmmyyyy')
AND OBVS.END_DT = to_date('31129999', 'ddmmyyyy')
AND OBVS.REFERENTIE_A LIKE 'OFM%'
AND OIBL.INFRA_KEY = IH.INFRA_KEY
AND OIBL.ORDERS_KEY = OH.ORDERS_KEY
AND IBS.INFH_ID = IH.INFH_ID
AND ODL.ORDH_ID = OH.ORDH_ID
AND DBS.DEBH_ID = ODL.DEBH_ID
AND OBVS.ORDH_ID = ODL.ORDH_ID
Order By IBS.LIJ
All the columns which are present in the where condition are having either Index/key (Primary/unique) except END_DT column.
Please AdvisePredicate pushing can help when it greatlly restricts the number of rows - you must experiment - might not work with all predicates pushed (as shown here)
select distinct
ibs.adsl_access_info,
ibs.lij,
obvs.o_number,
dbs.ckr_nummer_contractant,
dbs.dnumber
from (select infh_id,adsl_access_info,lij
from cd.ibs
where end_dt = to_date('31129999','ddmmyyyy')
) ibs,
(select infra_key,orders_key
from cd.oibl
where end_dt = to_date('31129999','ddmmyyyy')
) oibl,
(select ordh_id,regexp_substr(obvs.referentie_a,'[[:digit:]]+') as o_number
from cd.obvs
where end_dt = to_date('31129999','ddmmyyyy')
and referentie_a like 'OFM%'
) obvs,
(select debh_id,ckr_nummer_contractant,dnumber
from cd.dbs
where end_dt = to_date('31129999','ddmmyyyy')
) dbs,
cd.ih,
cd.odl,
cd.oh
where oibl.infra_key = ih.infra_key
and oibl.orders_key = oh.orders_key
and ibs.infh_id = ih.infh_id
and odl.ordh_id = oh.ordh_id
and dbs.debh_id = odl.debh_id
and obvs.ordh_id = odl.ordh_id
order by ibs.lijRegards
Etbin -
How to create sql query for item master with operator LIKE with variables?
hi all,
How to create sql query for item master with
operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
JeyakanthanHi Jeyakanthan,
here is an example (put the like statement into the where field)
SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
Regards Steffen -
How to write sql query for counting pairs from below table??
Below is my SQL table structure.
user_id | Name | join_side | left_leg | right_leg | Parent_id
100001 Tinku Left 100002 100003 0
100002 Harish Left 100004 100005 100001
100003 Gorav Right 100006 100007 100001
100004 Prince Left 100008 NULL 100002
100005 Ajay Right NULL NULL 100002
100006 Simran Left NULL NULL 100003
100007 Raman Right NULL NULL 100003
100008 Vijay Left NULL NULL 100004
It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains both left_leg and right_leg id, then it is called pair.)
I know there are three pairs under id "100001" :-
1. 100002 and 100003
2. 100004 and 100005
3. 100006 and 100007
100008 will not be counted as pair because it does not have right leg..
But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005Sounds like this to me
DECLARE @ID int
SET @ID = 100001--your passed value
SELECT left_leg,right_leg
FROM table
WHERE (user_id = @ID
OR parent_id = @ID)
AND left_leg IS NOT NULL
AND right_leg IS NOT NULL
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How do tune sql query? Can somebody help me in this? Atleast prescribe book
how do tune sql query? Can somebody help me in this? Atleast prescribe a reference book.
I am not able understand How to analyze tkproof output.Check out asktom.oracle.com
Lot's of threads on interpreting tkprof output - no simple easy solution here.
You need to understand what is happening and THINK. Then you can be a good engineer.
As for good books...
Tom Kyte's books are really, really good.
http://www.amazon.com/Effective-Oracle-Design-Osborne-ORACLE/dp/0072230657/ref=sr_1_3?ie=UTF8&s=books&qid=1266783471&sr=8-3
http://www.amazon.com/Expert-Oracle-Database-Architecture-Programming/dp/1590595300/ref=sr_1_1?ie=UTF8&s=books&qid=1266783471&sr=8-1
Good luck! -
How to transport SQL Query from SQVI Tcode?
Dear Friends,
Can any one tell me how to transport SQL Query from <b>SQVI</b> Tcode.
Full Points will be rewarded.
Thanks & Reagrds
Ravigo to sqvi tool .....
select u r query name ......in the menubar ....quickview....> additianal functions.......>generate program
after doing generate program ....go to again same menu path as i have mentioned above [quickview....> additianal functions.......>display report name it will give the report name of the select query ..........copy the report name and give it abap editor[se38] u will get u r query program......with all authority checks.....
in start of selection event of u r program u will find u r select query.
reward points if helpful -
How to write sql query for below mentioned eaxmple.
Hi,
I have requirement.
There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
example: table TEST.
COLA COLB COLC COLD COLE COLF MANAGER 5 NULL NULL 3 NULL
SR.MANAGER 6 3 NULL NULL NULL
VP 5 5 4 5 5
I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
I need output as below.
COLB COLC COLD COLE COLF
5(manager) 3(sr.manger) 4(vp) 3(manger) 3(vp)
Please provide the for above mentioned output.
ThanksDuplicate thread. please view the answer posted in your first thread.
how to write sql query.
And, please don't post any duplicate thread.
Regards.
Satyaki De.
Maybe you are looking for
-
Jabber and IP Phone 8945 call history synchronisation
Hi We're running 8945 IP Phones and CUPC 8.5.5 and a few Jabber 9.0.4 in a CTI deskphone mode. Currently both call history are linked to the device. No synchronisation between IP Phone and CUPC / Jabber. Even the missed calls count is not cleared on
-
UPGRADE ASSISTANT QUESTIONS for ECC6.0???????911
I have used upgrade assistant in the past for 4.6C and 4.7 upgrades and had no problems. I am having trouble getting the assistant to work through the internet browers. I need help with a couple of questions: First: Do I need do a prepare and SERV
-
Using Dreamweaver CS6, get 'Adobe Dreamweaver CS6 has stopped working'
This happened in CS5 as well. We have a large site (57800 files total). When we run Link Checker, we get 47841 Orpahned files. When I right click and attempt to save the file, I get a message box with the error listed above. When I click on debug,
-
Nokia Music on Windows 8 PC - My Music on network ...
Hello, I installed Nokia Music on my Windows 8 PC (in prep to buy a new Lumia 928 when it comes to Vzw) to get a feel for how it works. I do like it, but it wont see any of my "local" music, which is all hosted on a network share on a Windows 2012
-
Leopard installation stops midway through
Everything was going fine with my installation until it got to where it said it had about 10 minutes remaining. The bar is almost all the way across. The installation just stopped and for well over an hour, it hasn't moved at all. I don't know what t