Display performance of resources by using the index of area XDBHI_IDX
Hi allWe have an application XMLDB home grown to make the validation of diagram against incoming messages. Enforcement issues several queries like below. I know, it analyzes the hard, which is very bad, but it's not where the real problem is at the moment. The problem is with the index of XDBHI_IDX field against xdb resource table $. We use a very specific way of results in the rows returned 0 or 1, but as you can see that the domain index has an intermediate result of 48041 lines, so the index is not effective here. Statistics are up to date, the index has been rebuild. Does anyone know what we can do with the index of the field to do what he must do: identify an xml document in this way?
SELECT 0
FROM
resource_view WHERE any_path=
'/home/app/incoming/ARCH_IN/2012/01/592174'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.02 0.02 0 1041 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 81.26 85.43 0 202556 576158 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 6 81.28 85.45 0 203597 576158 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 67 (app) (recursive depth: 3)
Rows Row Source Operation
------- ---------------------------------------------------
0 TABLE ACCESS BY INDEX ROWID XDB$RESOURCE (cr=341531 pr=0 pw=0 time=60883725 us)
48041 DOMAIN INDEX XDBHI_IDX (cr=311030 pr=0 pw=0 time=1548774 us)
Kind regardsRob.
PS: The database version is 10.2.0.3.0
Hi Rob,
See EQUALS_PATH (and UNDER_PATH) conditions: http://docs.oracle.com/cd/B19306_01/server.102/b14200/conditions010.htm#i1051094
SQL> select *
2 from resource_view v
3 where equals_path(v.res, '/office/excel/docs') = 1
4 ;
Execution Plan
----------------------------------------------------------
Plan hash value: 3007404872
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 81 | 17172 | 32 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| XDB$RESOURCE | 81 | 17172 | 32 (0)| 00:00:01 |
|* 2 | DOMAIN INDEX | XDBHI_IDX | | | | |
--------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("XDB"."EQUALS_PATH"(SYS_MAKEXML('8758D485E6004793E034080020B242C6',734
,"XMLEXTRA","XMLDATA"),'/office/excel/docs',8888)=1)
Tags: Database
Similar Questions
-
What is the right time to use the index with force?
I have an EMPLOYEE table. I join with the ROLE, and it has only about 200 distinct values on column EMPLOYEE. EMPLOYEE_TYPE_ID.
Select / * + INDEX (an i_employee_type_id) * / b.SID as EMP_NAME, b.role_cd in the ROLE
Of
EMPLOYEE,
B ROLE
where
a.EMPLOYEE_TYPE_ID = b.EMPLOYEE_TYPE_ID
AND a.EFFECTIVE_END_TS > = systimestamp;
Is it a good idea to use the index? .. Or let the full table scan.
SQL > select distinct EMPLOYEE_TYPE_ID of the EMPLOYEE;
238 selected lines.
If you don't know it will help not to use.
Personally, I found several SQLs with index finger tips (written by programmers thinking index access is ALWAYS GOOD) end up harming performance. Oracle made a reading diluvium full table scan, single index reads as follows, according to the % of the returned array it is actually faster to do a full table scan. The optimizer did a great job to determine this.
If you think there are cardinality estimation problems, and the optimizer expects a large number of lines when there are actually few being returned, in THIS case a suspicion was justified. Even so, in this case, I prefer that oracle manages the flag itself.
You can do this by running the SQL tuning advisor. In fact, it will trigger the optimizer checks that the estimates are turned off and it will create a profile for you. (A profile is actually a stored set of advice that set the execution plan for you). If at the point where the underlying data changes significantly and profile ends up hurting performance, you do not need to touch the code like you would with manually added notes, you can just disable or delete the profile and let the optimizer re - analyze the statement.
Concerning
EDIT: In case of small tables, it is preferable to just cache the whole table in the POOL to KEEP and let oracle scan if necessary.
Edit2: With the notable exception of index fast full scans, which are diluvium index readings. But they are only relevant when the request is quite satisfied by the index and has no need to visit the table.
-
I have problem with a query as follows. It does not index when I keep a function on the left side of the comparison in which the condition.
But when I remove the function is using the index.
With BLC AS Name Null? Type ----------------------------------------- -------- ---------------------------- ID NOT NULL NUMBER MASTER_VALUE NOT NULL NUMBER(8) DESC_TEXT_ID NUMBER GVM VARCHAR2(50) MASTER_LOOKUP_ID NOT NULL NUMBER WORK_SECTION_ID NUMBER AUDIT_TRAIL_NO NUMBER SQL> SELECT COUNT(*) FROM BLC; COUNT(*) ---------- 7769 SQL> SELECT COUNT(DISTINCT(GVM)) "distinct" FROM BLC; distinct ---------- 1350 SQL> SELECT COUNT(*) "nulls" FROM BLC WHERE GVM IS NULL; nulls ---------- 6419 SQL> SELECT COLUMN_NAME,INDEX_NAME FROM DBA_IND_COLUMNS WHERE TABLE_NAME='BLC'; COLUMN_NAME INDEX_NAME ---------------------------------------- ------------------------------ MASTER_LOOKUP_ID LKPCDE_MSTLKP_FK_I WORK_SECTION_ID LKPCDE_WRKSEC_FK_I GVM LKPCDE_UK MASTER_VALUE LKPCDE_MASTERID_VALUE_UK MASTER_LOOKUP_ID LKPCDE_MASTERID_VALUE_UK ID LKPCDE_PK SQL> EXPLAIN PLAN FOR SELECT ID FROM BLC WHERE UPPER ( GVM) = 'MAIN_ORG'; Explained. SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Plan hash value: 3196655606 -------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time| -------------------------------------------------------------------------------------- PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 78 | 624 | 18 (0)| 00:00:01 | |* 1 | TABLE ACCESS FULL| BLC | 78 | 624 | 18 (0)| 00:00:01 | -------------------------------------------------------------------------------------- Predicate Information (identified by operation id): PLAN_TABLE_OUTPUT ----------------------------------------------------------------------------------------------------------------------------------- 1 - filter(UPPER("GVM")='MAIN_ORG') 13 rows selected. SQL> EXPLAIN PLAN FOR SELECT ID FROM BLC WHERE GVM = 'MAIN_ORG'; Explained. SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Plan hash value: 1620245961 -------------------------------------------------------------------------------- ---------------- | Id | Operation | Name | Rows | Bytes | Cost (% CPU)| Time | -------------------------------------------------------------------------------- ---------------- PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 8 | 2 (0)| 00:00:01 | | 1 | TABLE ACCESS BY INDEX ROWID| BLC | 1 | 8 | 2 (0)| 00:00:01 | |* 2 | INDEX UNIQUE SCAN | LKPCDE_UK | 1 | | 1 (0)| 00:00:01 | -------------------------------------------------------------------------------- ---------------- PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("GVM"='MAIN_ORG') 14 rows selected. SQL> EXPLAIN PLAN FOR SELECT /* INDEX(LKPCDE_UK) */ ID FROM BLC WHE RE UPPER ( GVM ) = 'MAIN_ORG'; Explained. SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Plan hash value: 3196655606 -------------------------------------------------------------------------------- ------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- ------ PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 78 | 624 | 18 (0)| 00:0 0:01 | |* 1 | TABLE ACCESS FULL| BLC | 78 | 624 | 18 (0)| 00:0 0:01 | -------------------------------------------------------------------------------- ------ Predicate Information (identified by operation id): PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- --------------------------------------------------- 1 - filter(UPPER("GVM")='MAIN_ORG') 13 rows selected.
Please let me know how I can force it to use an index as it is causing the CPU usage.
I can't change the query in the application it is used in several places.
Thank you
And/or read: ORACLE-BASE - Oracle function index
-
Using the index of multiple values
Hi guys,.
Trying to assess the benefits of the addition of index of multiple values, a quick question on the index of multiple values:
Here's my content from the cache:
Key (EmpID), value [employee (age int, double salary, Department of String)]
(1, new employee (25, 35000.0, "Admin"));
(2, new employee (22, 30000.0, "Admin"));
(3, new employee (34, 40000.0, 'Communications'));
(4, new employee (36, 41000.0, "Admin"));
(5, new employee (36, 42000.0, "HR"));
(6, new employee (29, 30000.0, "HR"));
(7, new employee (51, 50000.0, "BackOffice"));
(8, new employee (36, 35000.0, "HR"));
(9, new employee (46, 45000.0, "Admin"));
(10, new employee (48, 47000.0, "HR"));
If I still want to find all employees in the 'Human resources' Department and whose salary is more than 35000.
Eventually, I would like to do the following:
ValueExtractor salExtractor = new PofExtractor (Integer.class, 2);
ValueExtractor depExtractor = new PofExtractor (String.class, 3);
cache.addIndex (salExtractor, false, null);
cache.addIndex (depExtractor, false, null);
EqualsFilter departmentFilter = new EqualsFilter (depExtractor, 'HR');
GreaterFilter salFilter = new GreaterFilter (salExtractor, 35000);
Filter allFilter = new AllFilter (new filter [] {departmentFilter, salFilter});
Employees value = cache.entrySet (allFilter));
For my usecase above how can I use the indexing of multiple values to the same query?
ValueExtractor salExtractor = new PofExtractor (Integer.class, 2);
ValueExtractor depExtractor = new PofExtractor (String.class, 3);
MultiExtractor mExtractor is new MultiExtractor (new ValueExtractor [] {salExtractor, depExtractor});.
cache.addIndex (mExtractor, false, null);
But how can I use the extractor to create multivalued filter queries for employees in the Department of human resources with greater than 35000 salary? Any ideas are much appreciated.
Thank youD wrote:
Hi guys,.Trying to assess the benefits of the addition of index of multiple values, a quick question on the index of multiple values:
Here's my content from the cache:
Key (EmpID), value [employee (age int, double salary, Department of String)]
(1, new employee (25, 35000.0, "Admin"));
(2, new employee (22, 30000.0, "Admin"));
(3, new employee (34, 40000.0, 'Communications'));
(4, new employee (36, 41000.0, "Admin"));
(5, new employee (36, 42000.0, "HR"));
(6, new employee (29, 30000.0, "HR"));
(7, new employee (51, 50000.0, "BackOffice"));
(8, new employee (36, 35000.0, "HR"));
(9, new employee (46, 45000.0, "Admin"));
(10, new employee (48, 47000.0, "HR"));If I still want to find all employees in the 'Human resources' Department and whose salary is more than 35000.
Eventually, I would like to do the following:
ValueExtractor salExtractor = new PofExtractor (Integer.class, 2);
ValueExtractor depExtractor = new PofExtractor (String.class, 3);
cache.addIndex (salExtractor, false, null);
cache.addIndex (depExtractor, false, null);EqualsFilter departmentFilter = new EqualsFilter (depExtractor, 'HR');
GreaterFilter salFilter = new GreaterFilter (salExtractor, 35000);
Filter allFilter = new AllFilter (new filter [] {departmentFilter, salFilter});
Employees value = cache.entrySet (allFilter));For my usecase above how can I use the indexing of multiple values to the same query?
ValueExtractor salExtractor = new PofExtractor (Integer.class, 2);
ValueExtractor depExtractor = new PofExtractor (String.class, 3);
MultiExtractor mExtractor is new MultiExtractor (new ValueExtractor [] {salExtractor, depExtractor});.
cache.addIndex (mExtractor, false, null);But how can I use the extractor to create multivalued filter queries for employees in the Department of human resources with greater than 35000 salary? Any ideas are much appreciated.
Thank you
I remember, values multiple index refers to a different concept: a multivalued index means that you can retrieve a collection of values of similar role of an attribute on which you can do Contains, ContainsAll filtering, and ContainsAny.
In this case to fully the lever consistency of querying capabilities, you would
- either add a sorted index with a custom comparator that compares the tables containing a salary and a Department on a first salary so the base of the Department and add a filter custom which is able to take advantage of the index for the request for the salary and also able to filter on the element of the array of index service
-Add two independent indices (a sorted index of wages and a unsorted for the Department), in which case you can leverage all existing (GreaterThanFilter, EqualsFilter and AndFilter) codeBest regards
Robert
-
How to monitor the SQL perticuler using the INDEX or not?
I'm running on a long-term quary and the output is coming very late. So, I want to know that the quary sql uses the index or not? How do I know that?Hello
You have not provided your db version?
You can check v $ object_usage in a simple way. Try to check the explanation of your query if you current sql is by using your existing index or not.
Check with dbms_xplan.displayRequest to go through the links of Ask tom and jonathan lewis
http://jonathanlewis.WordPress.com/2007/02/15/index-not-used-10G/
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:736825544526HTH
-Pounet N
-
Hi all
Version of DB: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
Here is the description of the problem:
(The statistics are up to date for all tables).
The query below does not use the index on ACCOUNTS_LIVE (ID). (Unique index)
Line 23 of the query uses accounts_live.id.SQL> explain plan for 2 select txn.account_number,to_number(txn.amount_lcy) txn_amt,to_date(booking_date,'YYYYMMDD') TXN_DATE, 3 sal.latest_sal,sal.sal_date,customer_name,employer_name, 4 decode(COMMUNICATION_TYPE_1,'MOBILE',COMMUNICATION_NO_1, 5 decode(COMMUNICATION_TYPE_2,'MOBILE',COMMUNICATION_NO_2)) mob, 6 txn.CURRENCY, CHEQUE_NUMBER,trans_dets,trans_reference,target,teller_id,acc.category,acc.inactive_marker, 7 acc.posting_restrict,cus.sector,cus.industry 8 from coreadmin.Gtxn_dtl_v1 txn, 9 (select account_number,round(to_number(nvl(amount_lcy,0)),2) latest_sal,TXN_DATE sal_date,rr 10 from 11 (select to_date(booking_date,'YYYYMMDD') TXN_DATE,batch_id,account_number,amount_lcy 12 ,row_number() over (partition by account_number 13 order by to_date(booking_date,'YYYYMMDD') desc NULLS LAST, 14 batch_id desc nulls last) rr, 15 CURRENCY, CHEQUE_NUMBER,trans_dets,trans_reference 16 from coreadmin.Gtxn_dtl_v1 17 where transaction_code in ('204','938') 18 and to_number(amount_lcy) > 0) 19 where rr = 1 20 ) sal,accounts_live acc,customers_live cus 21 where to_date(booking_date,'YYYYMMDD') between to_date('030109','DDMMRR') and to_date('020209','DDMMRR') 22 and txn.account_number = sal.account_number 23 and txn.account_number = acc.id 24 and txn.CUSTOMER_ID = cus.CUSTOMER_number 25 and target in ('30','31','32') 26 / Explained. SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 920245766 ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 363M| 121G| | 223K (4)| 00:44:47 | |* 1 | HASH JOIN | | 363M| 121G| 6232K| 223K (4)| 00:44:47 | |* 2 | VIEW | | 34453 | 5820K| | 147K (1)| 00:29:36 | |* 3 | WINDOW SORT PUSHED RANK | | 34453 | 1480K| 4072K| 147K (1)| 00:29:36 | |* 4 | FILTER | | | | | | | | 5 | INLIST ITERATOR | | | | | | | |* 6 | TABLE ACCESS BY INDEX ROWID| GTXN_DTL_V1 | 34453 | 1480K| | 147K (1)| 00:29:31 | |* 7 | INDEX RANGE SCAN | IDX_TXN5 | 707K| | | 1815 (2)| 00:00:22 | |* 8 | HASH JOIN | | 598K| 106M| 20M| 63724 (1)| 00:12:45 | |* 9 | MAT_VIEW ACCESS FULL | CUSTOMERS_LIVE | 227K| 17M| | 2239 (4)| 00:00:27 | |* 10 | HASH JOIN | | 598K| 59M| 9504K| 57157 (1)| 00:11:26 | | 11 | MAT_VIEW ACCESS FULL | ACCOUNTS_LIVE | 249K| 6577K| | 1832 (2)| 00:00:22 | |* 12 | TABLE ACCESS BY INDEX ROWID | GTXN_DTL_V1 | 597K| 43M| | 52319 (1)| 00:10:28 | |* 13 | INDEX RANGE SCAN | IDX_TXN11_V1 | 1204K| | | 3931 (2)| 00:00:48 | ----------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("TXN"."ACCOUNT_NUMBER"="ACCOUNT_NUMBER") 2 - filter("RR"=1) 3 - filter(ROW_NUMBER() OVER ( PARTITION BY "ACCOUNT_NUMBER" ORDER BY TO_DATE("BOOKING_DATE",'YYYYMMDD') DESC NULLS LAST,INTERNAL_FUNCTION("BATCH_ID") DESC NULLS LAST)<=1) 4 - filter(TO_DATE('030109','DDMMRR')<=TO_DATE('020209','DDMMRR')) 6 - filter(TO_NUMBER("AMOUNT_LCY")>0) 7 - access("TRANSACTION_CODE"='204' OR "TRANSACTION_CODE"='938') 8 - access("TXN"."CUSTOMER_ID"="CUS"."CUSTOMER_NUMBER") 9 - filter("TARGET"='30' OR "TARGET"='31' OR "TARGET"='32') 10 - access("TXN"."ACCOUNT_NUMBER"="ACC"."ID") 12 - filter("TXN"."CUSTOMER_ID" IS NOT NULL) 13 - access(TO_DATE("BOOKING_DATE",'YYYYMMDD')>=TO_DATE('030109','DDMMRR') AND TO_DATE("BOOKING_DATE",'YYYYMMDD')<=TO_DATE('020209','DDMMRR')) 38 rows selected. SQL> select index_name 2 from dba_ind_columns 3 where table_name = 'ACCOUNTS_LIVE' 4 and column_name = 'ID'; INDEX_NAME ------------------------------ IDX_ACCLIVE
11 the order ID explain plan shows that the index does not use.
Please suggest.
Thanks in advance,
JacWhat happens when you force the index by using hint and use the hash between txn and acc join?
See you soon
Sarma. -
Using the index function in where clause of Exchange.
Hello friends,
I need your help with a problem.
I have a query that uses two table Say T1 and T2, where C1 is common column with which both are joined.
C1 is the primary key in T1, but no index available in Q2 for the C1. T1C2 is the column that we want to select.
(Note that table may be a Master table)
Now let's see the query:
Select T1C2
From T1, T2
where T2. C1 = T1. C1
Here where the clause may have other conditions and From clause can have other tables as needed.
I want to know that if I have change the query as continuation of leave my query to use the index available of T1. C1.
Select T1C2
from T1, T2
where T1. C1 = T2.C1
Then, the query uses the index available of T1. and I get better performance. Even a small improvement of performance help me much because this type of query is used in a loop where clause (so it will be run several times).
Please advise on this...
Kind regards
Lifexisxnotxsoxbeautiful...Hello
18:43:17 rel15_real_p>create table t1(c1 number primary key, c2 number); Table created. 18:43:26 rel15_real_p>create table t2(c1 number, c2 number); 18:45:08 rel15_real_p> 18:45:09 rel15_real_p>begin 18:45:09 2 for i in 1..100 18:45:09 3 loop 18:45:09 4 insert into t1(c1,c2) values (i,i+100); 18:45:09 5 end loop; 18:45:09 6 commit; 18:45:09 7 end; 18:45:09 8 / PL/SQL procedure successfully completed. 18:45:09 rel15_real_p> 18:45:09 rel15_real_p> 18:45:09 rel15_real_p>begin 18:45:09 2 for i in 1..100 18:45:09 3 loop 18:45:09 4 insert into t2(c1,c2) values (i,i+200); 18:45:09 5 end loop; 18:45:09 6 commit; 18:45:09 7 end; 18:45:09 8 / 18:45:23 rel15_real_p>select count(*) from t1; COUNT(*) ---------- 100 18:45:30 rel15_real_p>select count(*) from t2; COUNT(*) ---------- 100 18:45:49 rel15_real_p>select index_name,index_type from user_indexes where table _name='T1'; INDEX_NAME INDEX_TYPE ------------------------------ --------------------------- SYS_C0013059 NORMAL 18:48:21 rel15_real_p>set autotrace on 18:52:25 rel15_real_p>Select T1.C2 18:52:29 2 From T1, T2 18:52:29 3 where T2.C1 = T1.C1 18:52:29 4 / C2 ---------- 101 102 103 104 105 ..... ...... C2 ---------- 200 100 rows selected. Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=7 Card=100 Bytes= 900) 1 0 HASH JOIN (Cost=7 Card=100 Bytes=3900) 2 1 TABLE ACCESS (FULL) OF 'T1' (TABLE) (Cost=3 Card=100 By es=2600) 3 1 TABLE ACCESS (FULL) OF 'T2' (TABLE) (Cost=3 Card=100 By es=1300) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 21 consistent gets 0 physical reads 0 redo size 1393 bytes sent via SQL*Net to client 562 bytes received via SQL*Net from client 8 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 100 rows processed 18:52:31 rel15_real_p>analyze table t1 compute statistics; Table analyzed. 18:55:35 rel15_real_p>analyze table t2 compute statistics; 18:55:38 rel15_real_p>set autotrace on 18:55:42 rel15_real_p>Select T1.C2 18:55:43 2 From T1, T2 18:55:45 3 where T2.C1 = T1.C1 18:55:46 4 / C2 ---------- 101 102 103 104 105 ..... ...... C2 ---------- 200 100 rows selected. Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=100 Bytes=7 00) 1 0 MERGE JOIN (Cost=6 Card=100 Bytes=700) 2 1 TABLE ACCESS (BY INDEX ROWID) OF 'T1' (TABLE) (Cost=2 Ca rd=100 Bytes=500) 3 2 INDEX (FULL SCAN) OF 'SYS_C0013059' (INDEX (UNIQUE)) ( Cost=1 Card=100) 4 1 SORT (JOIN) (Cost=4 Card=100 Bytes=200) 5 4 TABLE ACCESS (FULL) OF 'T2' (TABLE) (Cost=3 Card=100 B ytes=200) Statistics ---------------------------------------------------------- 1 recursive calls 0 db block gets 23 consistent gets 0 physical reads 0 redo size 1393 bytes sent via SQL*Net to client 562 bytes received via SQL*Net from client 8 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 100 rows processed 18:56:56 rel15_real_p>Select T1.C2 18:56:56 2 From T1, T2 18:56:56 3 where T1.C1 = T2.C1 18:56:58 4 / C2 ---------- 101 102 103 104 105 ..... ...... C2 ---------- 200 100 rows selected. Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=100 Bytes=7 00) 1 0 MERGE JOIN (Cost=6 Card=100 Bytes=700) 2 1 TABLE ACCESS (BY INDEX ROWID) OF 'T1' (TABLE) (Cost=2 Ca rd=100 Bytes=500) 3 2 INDEX (FULL SCAN) OF 'SYS_C0013059' (INDEX (UNIQUE)) ( Cost=1 Card=100) 4 1 SORT (JOIN) (Cost=4 Card=100 Bytes=200) 5 4 TABLE ACCESS (FULL) OF 'T2' (TABLE) (Cost=3 Card=100 B ytes=200) Statistics ---------------------------------------------------------- 1 recursive calls 0 db block gets 23 consistent gets 0 physical reads 0 redo size 1393 bytes sent via SQL*Net to client 562 bytes received via SQL*Net from client 8 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 100 rows processed
-Pavan Kumar N
-
Performing a Firmware Upgrade using the built-in Web server
This video provides step by step instructions to perform a firmware update using the integrated Web (EWS) server for single function of HP LaserJet and multifunction printers.
For other helpful videos, go to hp.com/supportvideos or youtube.com/hpsupport. Several support options for your printer are available at hp.com support.
This video was produced by HP.
I hope you find this information useful.
-
Performing a Firmware Upgrade using the integrated HP printers Web server
Hi all
This video provides step by step instructions to perform a firmware update using the integrated Web (EWS) server for single function of HP LaserJet and multifunction printers.
Hope that the information contained in my previous post are useful if you are in the need to update the firmware on your Laserjet.
-
SDO_NN cannot be assessed without using the index when put inside subquery
Hi all
I met a problem when you use the function sdo_nn to find the nearest neighbor. Here is my scenario:
_ I have 2 customer and store tables.
Customer table _ a client_ID and a 2D sdo_geom point
_ Store table has store_ID and a 2D polygon sdo_geom.
In the beginning, I have this query to find the nearest store to each customer as below:
Select s.STORE_ID, c.CLIENT_ID
store customer, s c
where sdo_nn (s.MYPOLYGON, c.MYPOINT, 'sdo_num_res = 1', 1) = "TRUE";
_It works as expected when it returns a table showing the nearest store each customer.
_Now I want to count the number of customers who have the same nearest store:
Select / * + INDEX (store store_spatial_idx, client_spatial_idx client) * / count (nearest_store. CLIENT_ID)
from (select s.STORE_ID, c.CLIENT_ID
store customer, s c
where sdo_nn (s.MYPOLYGON, c.MYPOINT, 'sdo_num_res = 1', 1) = "TRUE") nearest_store
Group of nearest_store. STORE_ID;
This query generates the following error:
Error report-
SQL error: ORA-13249: SDO_NN cannot be assessed without using the index
ORA-06512: at the 'MDSYS. MD", line 1723
ORA-06512: at the 'MDSYS. MDERR", line 17
ORA-06512: at the 'MDSYS. PRVT_IDX', line 9
13249 00000 - '%s '.
I'm pretty new to spatial databases and hope get help to go further. Thank you in advance!
Hello Pinball,
Oracle space tends to be a quite complex with many variables and moving parts. We chatted about the group to a sort of FAQ or guidelines to help people like you submit questions that actually answers. First of all, you really have to tell us the version of Oracle you are using. Particularly the problems involving the optimizer, version down to the exact defined patch number is a good idea. Secondly, you took the time to submit the question so I guess you want a response. If you really want to see the answer and then providing an example is one of the most important things that you can do. I'm going to do here for you, but in general people on this forum come and go and are often pushed into lurkitude, so if you want the coax to provide you with an example of work is the key.
DROP TABLE store1 PURGE; CREATE TABLE store1( store_id INTEGER NOT NULL ,shape MDSYS.SDO_GEOMETRY ,PRIMARY KEY(store_id) ); DROP TABLE client2 PURGE; CREATE TABLE client2( client_id INTEGER NOT NULL ,shape MDSYS.SDO_GEOMETRY ,PRIMARY KEY(client_id) ); CREATE OR REPLACE PROCEDURE seeder( p_client_count IN NUMBER ,p_store_count IN NUMBER ) AS sdo_foo MDSYS.SDO_GEOMETRY; int_counter NUMBER; FUNCTION random_point RETURN MDSYS.SDO_GEOMETRY AS num_x1 NUMBER; num_y1 NUMBER; BEGIN num_x1 := dbms_random.value(-179,179); num_y1 := dbms_random.value(-89,89); RETURN MDSYS.SDO_GEOMETRY( 2001 ,8265 ,MDSYS.SDO_POINT_TYPE( num_x1 ,num_y1 ,NULL ) ,NULL ,NULL ); END random_point; BEGIN int_counter := 1; FOR i IN 1 .. p_client_count LOOP -- Create a client point sdo_foo := random_point(); INSERT INTO client2 VALUES ( int_counter ,sdo_foo ); int_counter := int_counter + 1; END LOOP; int_counter := 1; FOR i IN 1 .. p_store_count LOOP -- Create a store polygon of some kind sdo_foo := MDSYS.SDO_GEOM.SDO_ARC_DENSIFY( MDSYS.SDO_GEOM.SDO_BUFFER( random_point() ,5000 ,0.05 ) ,0.05 ,'arc_tolerance=0.05' ); INSERT INTO store1 VALUES ( int_counter ,sdo_foo ); int_counter := int_counter + 1; END LOOP; COMMIT; END seeder; / BEGIN seeder(10000,200); END; / BEGIN INSERT INTO user_sdo_geom_metadata( table_name ,column_name ,diminfo ,srid ) VALUES ( 'STORE1' ,'SHAPE' ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05)) ,8265 ); COMMIT; EXCEPTION WHEN OTHERS THEN NULL; END; / BEGIN INSERT INTO user_sdo_geom_metadata( table_name ,column_name ,diminfo ,srid ) VALUES ( 'CLIENT2' ,'SHAPE' ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05)) ,8265 ); COMMIT; EXCEPTION WHEN OTHERS THEN NULL; END; / CREATE INDEX store1_spx ON store1 (shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX NOPARALLEL; CREATE INDEX client2_spx ON client2 (shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX NOPARALLEL; /* Works as expected */ SELECT s.store_id ,c.client_id ,MDSYS.SDO_NN_DISTANCE(1) FROM store1 s ,client2 c WHERE MDSYS.SDO_NN( s.shape ,c.shape ,'sdo_num_res=1' ,1 ) = 'TRUE'; /* No worky? Works for me */ SELECT ns.store_id ,COUNT(ns.client_id) FROM ( SELECT s.store_id ,c.client_id FROM store1 s ,client2 c WHERE MDSYS.SDO_NN( s.shape ,c.shape ,'sdo_num_res=1' ,1 ) = 'TRUE' ) ns GROUP BY ns.store_id ORDER BY ns.store_id;
So I wrote this about 12 c (12.1.0.2.0) and everything works fine for me. Then I moved back from 11 GR 2 (11.2.0.4.0) and of course, there are questions. So I guess that you don't use flavor of 11g. So at this point we can look at the docs and see for 11g, have you often need to specify which table is the head and that is the one that has the spatial index to use.
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_operat.htm#SPATL1032Its rather interesting that the optimizer of 12 c knows what you want, when I had to squint myself at your request and to play a little with the refining. Note that SDO_NN is sensitive, because the geometry of the main table should come second in the operator. I did not know that on the top of my head.
SELECT /*+ LEADING(c) INDEX(s store1_spx) */ s.store_id ,c.client_id ,MDSYS.SDO_NN_DISTANCE(1) FROM store1 s ,client2 c WHERE MDSYS.SDO_NN( s.shape ,c.shape ,'sdo_num_res=1' ,1 ) = 'TRUE'; SELECT ns.store_id ,COUNT(ns.client_id) FROM ( SELECT /*+ LEADING(c) INDEX(s store1_spx) */ s.store_id ,c.client_id ,MDSYS.SDO_NN_DISTANCE(1) FROM store1 s ,client2 c WHERE MDSYS.SDO_NN( s.shape ,c.shape ,'sdo_num_res=1' ,1 ) = 'TRUE' ) ns GROUP BY ns.store_id ORDER BY ns.store_id;
So I think that is your answer. Give it a shot and see if this fits the Bill. Of course, moving to 12 c would be useful for such things. It would be interesting to collect more examples of this kind of space thing where 12 c is the answer. Also, would be nice if we could mark somehow this discussion as applying only to 11g and earlier versions.
See you soon,.
Paul
-
SDO_NN giving ORA-13249: SDO_NN cannot be assessed without using the index
Hi people,
I do not understand why the SDO_NN gives ORA-13249 in circumstances.
SQL > SELECT SlavaTest WHERE SDO_NN s s.title (s.geometry, SDO_GEOMETRY (2001, 4326, SDO_POINT (14.0, 49.0, NULL), null, null)) = 'TRUE' and title like '%' and rownum < 10;
TITLE
--------------------------------------------------------------------------------
MultiPoint_305199
LineString_691779
MultiPolygon_180478
MultiPolygon_358113
MultiPolygon_53008
MultiPolygon_249905
MultiPolygon_204076
MultiPolygon_636994
MultiPoint_464514
9 selected lines.
SQL > SELECT SlavaTest WHERE SDO_NN s s.title (s.geometry, SDO_GEOMETRY (2001, 4326, SDO_POINT (14.0, 49.0, NULL), null, null)) = 'TRUE' and timestamp > = to_timestamp (January 6, 2011 ', ' dd/mm/yyyy') and rownum < 10;
SELECT SlavaTest WHERE SDO_NN s s.title (s.geometry, SDO_GEOMETRY (2001, 4326, SDO_POINT (14.0, 49.0, NULL), null, null)) = 'TRUE' and timestamp > = to_timestamp (January 6, 2011 ', ' dd/mm/yyyy') and rownum < 10
*
ERROR on line 1:
ORA-13249: SDO_NN cannot be assessed without using the index
ORA-06512: at the 'MDSYS. MD", line 1723
ORA-06512: at the 'MDSYS. MDERR", line 17
ORA-06512: at the 'MDSYS. PRVT_IDX', line 49
The spatial index is created with:
CREATE the INDEX SlavaTest_geometry_idx_spatial ON SlavaTest (geometry) INDEXTYPE IS mdsys.spatial_index;
'Title' and 'timestamp' columns have an index.
Note the query comes from Hibernate and I can't change it's arbitrary.Slava2 wrote:
What this means - there is a bug in Oracle?Well, it could probably be considered a, but [url http://docs.oracle.com/cd/E11882_01/appdev.112/e11830/sdo_operat.htm#i78067] documentation on SDO_NN warns you:
Documentation says:
However, if the column in the WHERE clause predicate specifies a non-space column in the table for geometry1 with an associated index, make sure that this index is not used by specifying the NO_INDEX indicator for this index.See you soon,.
Stefan -
SELECT on a table in the INSERT statement uses the INDEX
Hello world
I have a strange problem with EA Oracle 10 g (64-bit) running on a Linux system. The situation is, I developed a Java program to migrate one client system to another. One of the steps in the migration fills a new table with the data from the old system. Given that the data on the old system structure is fundamentally different from that new, I have to check each time I read a line from the old system, if I have already created an entity on the new table, and if so, update certain attributes. The WHERE clause of this audit uses a key of the company indexed on the new table. The problem is now, that Oracle does not use the index on the key attribute of the company, but it makes table scans complete to select the line. As you can imagine, the lines first thousand or so go fast, but the amount increases, the program becomes slower and slower.
If I do a "scan" when executing the migration program, Oracle change the execution plan and use the index on the attribute key and everything works fast and smooth. However, if I do the analysis on the empty table first, nothing changes (which I understand it perfectly, since there is nothing to analyze, at this point). By integrating a hint of 'INDEX' (table) in the statement SELECT does not change the full implementation plan (also table scans).
Is it possible to change this behavior, in order to SELECT it uses the index of key business from the beginning?
Greetings from Cologne,
Thorsten.
Published by: thkitz on 13.03.2012 18:27thkitz wrote:
SELECT STATEMENT ALL_ROWSCost: 2 Bytes: 76 Cardinality: 2 7 TABLE ACCESS BY INDEX ROWID TABLE AIDATINT.PRVVSSCHADENKORRESPONDENZ Cost: 2 Bytes: 76 Cardinality: 2 6 BITMAP CONVERSION TO ROWIDS 5 BITMAP OR 2 BITMAP CONVERSION FROM ROWIDS 1 INDEX RANGE SCAN INDEX AIDATINT.I_PRVVSSCHADENKORRESPONDENZ_1 Cost: 1 4 BITMAP CONVERSION FROM ROWIDS 3 INDEX RANGE SCAN INDEX AIDATINT.I_PRVVSSCHADENKORRESPONDENZ_2 Cost: 1
I would have thought that as a plan as possible. It is not a concatenation, is a btree/bitmap conversion.
Allude to this plan you need / * + index_combine (table_alias index1 index2) * /.
For 10g and later the index can be specified by name or by descriptionI'm a bit puzzled why the plan changes after truncate - but maybe my comment about not cleared statistics is no longer true. It is easy enough to check if I'm right or wrong on your version of Oracle.
Concerning
Jonathan Lewis
http://jonathanlewis.WordPress.com
Author: core Oracle -
If the INSTR function will not use the INDEX o?
Hi all
I have a querry as
Is simple index on column Col1. If we use the index will be used or full table scan will happen in this scenario?Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0 ;
Please give me explanatory answer because I have doubts
DhabasHello
You must use the index function if you want to avoid the full table scan. Check this box
SQL> create table tab1(col1 varchar(20)) 2 / Table created. SQL> insert into tab1 values ('XXAB') 2 / 1 row created. SQL> create index col1_idx on tab1(col1); Index created. SQL> explain plan for Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0; Explained. SQL> set autotrace on SQL> Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0; XXAB Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=1 Bytes=12) 1 0 TABLE ACCESS (FULL) OF 'TAB1' (TABLE) (Cost=5 Card=1 Bytes =12) Statistics ---------------------------------------------------------- 4 recursive calls 0 db block gets 32 consistent gets 0 physical reads 0 redo size 234 bytes sent via SQL*Net to client 280 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL> create index col1_idx2 on tab1(Instr(Col1,'XX')); Index created. SQL> Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0; XXAB Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1 Bytes=12) 1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TAB1' (TABLE) (Cost=2 Ca rd=1 Bytes=12) 2 1 INDEX (RANGE SCAN) OF 'COL1_IDX2' (INDEX) (Cost=1 Card=1 ) Statistics ---------------------------------------------------------- 28 recursive calls 0 db block gets 22 consistent gets 0 physical reads 0 redo size 234 bytes sent via SQL*Net to client 280 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL>
Thank you
AJ -
Using the index to extract data without filter predicate
Hello
does anyone have an explanation for the following scenario:
I have a table T1 with an OID_IX index on column (object_id) - the table is a DEC dba_objects just to fill it with data.
There are no other current index. The table and index are analysed.
When I run the following query, the table is available in FULL (without using the index)
SELECT OBJECT_ID FROM T1;
SQL > select object_id from t1;
485984 selected lines.
Elapsed time: 00:00:01.76
Execution plan
----------------------------------------------------------
Hash value of plan: 3617692013
--------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 485K | 2372K | 1528 (1) | 00:00:19 |
| 1. TABLE ACCESS FULL | T1 | 485K | 2372K | 1528 (1) | 00:00:19 |
--------------------------------------------------------------------------
Statistics
----------------------------------------------------------
1 recursive calls
0 db block Gets
7396 gets coherent
0 physical reads
0 redo size
2887158 bytes sent via SQL * Net to client
5684 bytes received via SQL * Net from client
487 SQL * Net back and forth to and from the client
0 sorts (memory)
0 sorts (disk)
485984 rows processed
But if I add a predicate (even if it is useless in this case) the index is taken and that the query runs faster:
JDBC@toekb > select object_id from t1 where object_id. = - 999;
485960 selected lines.
Elapsed time: 00:00:01.40
Execution plan
----------------------------------------------------------
Hash value of plan: 3555700789
-------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 485K | 2372K | 242 (3) | 00:00:03 |
|* 1 | FULL RESTRICTED INDEX SCAN FAST | OID_IX | 485K | 2372K | 242 (3) | 00:00:03 |
-------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
1 Filter ("OBJECT_ID" <>-(999))
Statistics
----------------------------------------------------------
1 recursive calls
0 db block Gets
1571 gets coherent
0 physical reads
0 redo size
2766124 bytes sent via SQL * Net to client
5684 bytes received via SQL * Net from client
487 SQL * Net back and forth to and from the client
0 sorts (memory)
0 sorts (disk)
485960 rows processed
Here is my setup:
SQLsql-
drop table t1 purge;
create table t1 tablespace users in select * from dba_objects;
Insert into t1 (select * from t1);
commit;
Insert into t1 (select * from t1);
commit;
Insert into t1 (select * from t1);
commit;
create index oid_ix on t1 (object_id) tablespace users;
exec dbms_stats.gather_table_stats (null, 't1', cascade = > true, estimate_percent = > 100);
SQLsql-
In my case, the Table and the Index looks like this way:
JDBC@toekb > select table_name, NUM_ROWS, BLOCKS, AVG_SPACE from user_tables;
TABLE_NAME, NUM_ROWS BLOCKS AVG_SPACE
=======================================
485984 6944 T1 0
Elapsed time: 00:00:00.11
JDBC@toekb > select INDEX_NAME, BLEVEL, LEAF_BLOCKS, DISTINCT_KEYS, NUM_ROWS user_indexes.
INDEX_NAME BLEVEL LEAF_BLOCKS DISTINCT_KEYS NUM_ROWS
===================================================
2 1074 60745 485960 OID_IX
Elapsed time: 00:00:00.07
The table contains 7 times more than the index blocks!
any answer welcome
Best regards
Published by: guenterp on August 12, 2010 14:44The column is not defined as NOT NULL, then there may be values that are not in the index (because the index does not include null values). The useless predicate implies NOT NULL, then the index may be used.
-
SDO_NN cannot be assessed without using the index
Hello
I'll try to find more close neighbours of a point using two tables (grafo_ped_links & haltestellen) and I fail miserably quiet.
Select h.desc_i, grafo_ped_links h.numpal g, haltestellen h where (g.geometry, h.geometry) sdo_nn = 'true' and g.start_node_id = 355 and rownum < = 5
*
ERROR on line 1:
ORA-13249: SDO_NN cannot be assessed without using the index
ORA-06512: at the 'MDSYS. MD", line 1723
ORA-06512: at the 'MDSYS. MDERR", line 17
ORA-06512: at the 'MDSYS. PRVT_IDX', line 49
But I am able to find the nearest neighbor on individual tables (singularly) without any problem. I'm even able to find a WITHIN_DISTANCE using two tables (below the sql statement).
Select h.numpal from grafo_ped_links g, haltestellen h where SDO_WITHIN_DISTANCE (h.geometry, g.geometry, 'DISTANCE = 0.5 UNIT = KM') = 'TRUE' and g.start_node_id = 355;
NUMPAL
----------
5122
5103
5102
5120
5100
5301
5302
5303
I even dropped the indexes of the two tables and recreated them again. I read somewhere that the problem could be due to a lack of advice, so I tried the following and I still get the same error.
Select / * + LEADING (g) INDEX (h haltestellen_ridx) * / h.desc_i, h.numpal
of grafo_ped_links g, h haltestellen
where (g.geometry, h.geometry) sdo_nn = 'true' and g.start_node_id = 355 and rownum < = 5
Select / * + INDEX (h haltestellen_ridx) NO_INDEX (g grafo_ped_links_ridx) * / h.desc_i, h.numpal
of grafo_ped_links g, h haltestellen
where (g.geometry, h.geometry) sdo_nn = 'true' and g.start_node_id = 355 and rownum < = 5
Select / * + USE_NL (h, g) VALUE * / h.desc_i, h.numpal
of grafo_ped_links g, h haltestellen
where sdo_nn (g.geometry, h.geometry, 'sdo_num_res = 5', 1) = 'true' and g.start_node_id = 355 and rownum < = 5
Anyone can please, show me the way, or give a hint. I use oracle spatial 11g.
Thank you!
Cook
Published by: user611283 on December 30, 2009 06:11It should be 'TRUE '.
Select h.desc_i, grafo_ped_links h.numpal g, haltestellen h where (h.geometry, g.geometry) sdo_nn = 'TRUE' and g.start_node_id = 355 and rownum<=>=>
Maybe you are looking for
-
Satellite L300-1AQ - default installation of recovery, no operating system installed
Last year I had been making a blue screen of death for awhile and purchased on this site a for my model of laptop recovery disk. Turns out I didn't need to use it as it was a problem with Mcafee.However only 6 months later my phone started playing, w
-
Re: x 505-"turn off the display" does not properly
To make a long story short, I had a load of problems with my Toshiba Qosmio X 505. I talked to tech support and they had me completely clear the computer and reinstall the OS. Everything has been fine for days until today! For some reason any wheneve
-
Loading limits for a dynamic step name using the shipper of the property
Hello I'll have a stage whose name is upadted in a loop based on the index of the loop by using the 'Step.Name' API For this step, I'm trying to load limits using the stage property loader. One reason for the first iteration of the loop works, but fo
-
HP 2000-2c22DX Notebook PC: HP 2000 - black screen after login
Hi, I have a hp 2000 laptop that has a black screen after I login. I have used F9 or ESC tab and follow the directions shown by others with the same problem, but nothing has changed. Sometimes he goes to the site of Regclean Pro I installed when I go
-
New router with same name let me not able to administer EA6500
I have replace the EA6500 and therefore gave a new of the same name. Cisco Cloud Connect is really confused now and I can run no longer. It just hangs: http://www.ciscoconnectcloud.com/ So it also just hangs: www.linksyssmartwifi.com