Oracle 9i 10g slow spatial query
I have been using the following spatial query in oracle 9i to assign jurisdictions to spatial points.
SELECT /*+ordered*/ L.TCH_X_COORD, L.TCH_Y_COORD, T.NAME
FROM tis.tis_coordinates_hold_on L,
geospatial.mdt_admin_districts T
WHERE SDO_RELATE(T.GEOMETRY,
MDSYS.SDO_GEOMETRY(2001,41079,MDSYS.SDO_POINT_TYPE(tch_x_coord,tch_y_coord,NULL),
NULL,NULL),'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
AND tch_assigned_base_rte='M00001N'
By using the ordered hint I was able to double the retrieval rate. My problem is this: We are now migrating to oracle 10g, and the use of the ordered returns no rows (different incorrect results). If I remove the + ordered the results are correct, but I no longer get the increased speed of retrieval. Has anyone run into this problem, and can you suggest a way that I could speed up this query. As it stands now it takes more than 1/2 sec for each record retrieved, and I have millions of records !! Thanks.
We're using 10.2.4.0 I believe I have found the reason the queries were different. When I dropped the spatial index and re-created it, the query returned the same rows as 9i. However, I still have an issue with the speed. 10g appears to be about 1/3 as fast as 9i was. It doesn't seem to make any difference whether I put in the +ordered or not. Our dba says just based on cpu and processing speed the server that has 10g should be significantly faster. Any comments? Thanks.
Similar Messages
-
Hi,
I've found a discussion ended last year.
I've Oracle 11.2.0.3 with the same problem: some query are very slow (in the Excecution plan I've found "PX COORDINATOR")
Others installation of Oracle 11.2.0.3 haven't same problem: in the excecution plan found "DOMAIN INDEX".
I 've solved using statement "ALTER TABLE table_name NOPARALLEL;" which disable parallel feature in the table
Can anyone tell me if it's a good (bad) solution ? thank you
Bye
GabrieleGabriele,
As indicated in the original post - the following work-around might work for you for bug 9743250. What this does is essentially force the optimizer to ALWAYS use the spatial index. That is usually good - unless the query is actually more efficient not using the index, such as when it is much cheaper to just to a FTS. Anyhow this is what you can do from 11.2.0.1 to 11.2.0.3 - fixed in 11.2.0.4 and 12.1.0.1:
connect /as sysdba
alter session set current_schema=MDSYS;
DISASSOCIATE STATISTICS FROM INDEXTYPES spatial_index FORCE
DISASSOCIATE STATISTICS FROM PACKAGES sdo_3gl FORCE;
DISASSOCIATE STATISTICS FROM PACKAGES prvt_idx FORCE;
Bryan -
Spatial query w/ logical operators in a subquery on Linux using Oracle 10g
Hello...
I'm being given XML that I need to parse and create SQL from it. Below my signature is the SQL that I generate (its a simple example) and can be more elaborate due to the logical operators (AND and OR) given in the XML.
The problem that we're seeing is performance-based: when one of the logical operator queries is Spatial-based, like below. Running it in JDBC, the query never returns.
The spatial query just by itself returns ~300 rows (takes approximately 0.2 seconds). The "PERCENTAGE" query by itself returns about ~40000 rows (takes approximately ~.8 seconds).
If we run the query below with 2 non-spatial subqueries, the result returns and performance is very acceptable (~ 0.9 seconds)-- the result set is about 80000 rows.
Thanks,
Jim
=========================
SELECT
COLUMN_WE_WANT , RESULTS
FROM
TABLE_A
WHERE
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_A
WHERE
SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,
SDO_GEOMETRY(2003,
4326,
null,
SDO_elem_info_array( 1 , 3 , 1 ),
SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 ) )
) = 'TRUE'
OR
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_B
WHERE
SOME_PERCENTAGE_RATE_COLUMN < 90
)There is a spatial forum. You will likely have a far better experience there.
-
SQL slow after upgrading to Oracle Database 10g Enterprise Edition Release
Hi all:
We have recently upgraded our database from Oracle9i Enterprise Edition Release 9.2.0.6.0 to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
After that we found that our some sql getting very slow
for example query with 9i showing result in 4 seconds while in 10g showing result in 28 seconds.
Following is the execution plan of my query in Oracle9i
Operation Object PARTITION_START PARTITION_STOP COST
SELECT STATEMENT () 9458
NESTED LOOPS () 9458
SORT (UNIQUE)
INDEX (RANGE SCAN) BL_EQ_PK_N 2
VIEW () CONTAINER_INFO 2
UNION-ALL (PARTITION)
TABLE ACCESS (BY INDEX ROW SERVICE_EVENTS 1
NESTED LOOPS () 11
NESTED LOOPS () 10
NESTED LOOPS (OUTER) 9
NESTED LOOPS () 8
NESTED LOOPS () 7
NESTED LOOPS () 6
NESTED LOOPS () 5
NESTED LOOPS () 4
NESTED LOOPS (OUT 3
TABLE ACCESS (BY EQUIPMENT_USES 2
INDEX (UNIQUE S EQUSE_PK 1
TABLE ACCESS (BY SHIPPING_LINES 1
INDEX (UNIQUE S LINE_PK
INDEX (UNIQUE SCA EQHT_PK
TABLE ACCESS (BY I EQUIPMENT_TYPES 1
INDEX (UNIQUE SCA EQTP_PK
TABLE ACCESS (BY IN EQUIPMENT_SIZES 1
INDEX (UNIQUE SCAN EQSZ_PK
TABLE ACCESS (BY IND SHIP_VISITS 2
INDEX (RANGE SCAN) SVISIT_UK 1
TABLE ACCESS (BY INDE SHIPS 1
INDEX (UNIQUE SCAN) SHIP_PK
TABLE ACCESS (BY INDEX CARE_VIR_MAP 1
INDEX (UNIQUE SCAN) VIR_VESVOY
TABLE ACCESS (BY INDEX EQUIPMENT 1
INDEX (RANGE SCAN) EQ_EQUSE_FK
INDEX (RANGE SCAN) SEVENTS_EQUSE_FK_N
NESTED LOOPS () 7
NESTED LOOPS () 6
NESTED LOOPS () 5
NESTED LOOPS () 4
NESTED LOOPS (OUTER) 3
TABLE ACCESS (BY INDE EQUIPMENT_USES 2
INDEX (UNIQUE SCAN) EQUSE_PK 1
TABLE ACCESS (BY INDE SHIPPING_LINES 1
INDEX (UNIQUE SCAN) LINE_PK
INDEX (UNIQUE SCAN) EQHT_PK
TABLE ACCESS (BY INDEX EQUIPMENT_TYPES 1
INDEX (UNIQUE SCAN) EQTP_PK
TABLE ACCESS (BY INDEX R EQUIPMENT_SIZES 1
INDEX (UNIQUE SCAN) EQSZ_PK
TABLE ACCESS (BY INDEX RO EQUIPMENT 1
INDEX (RANGE SCAN) EQ_EQUSE_FK and following is my query plan in Oracle 10g
Operation Object PARTITION_START PARTITION_STOP COST
SELECT STATEMENT () 2881202
NESTED LOOPS () 2881202
SORT (UNIQUE) 2
INDEX (RANGE SCAN) BL_EQ_PK_N 2
VIEW () CONTAINER_INFO 2881199
UNION-ALL ()
NESTED LOOPS (OUTER) 2763680
NESTED LOOPS () 2718271
NESTED LOOPS () 2694552
NESTED LOOPS () 2623398
NESTED LOOPS (OUTER) 2623380
NESTED LOOPS () 2393965
NESTED LOOPS () 2393949
NESTED LOOPS () 2164536
NESTED LOOPS () 1706647
NESTED LOOPS () 854120
TABLE ACCESS (FU BL_EQUIPMENT 1515
TABLE ACCESS (BY EQUIPMENT_USES 1
INDEX (UNIQUE S EQUSE_PK 1
TABLE ACCESS (BY EQUIPMENT 1
INDEX (RANGE SCA EQ_EQUSE_FK 1
TABLE ACCESS (BY I EQUIPMENT_TYPES 1
INDEX (UNIQUE SCA EQTP_PK 1
TABLE ACCESS (BY IN EQUIPMENT_SIZES 1
INDEX (UNIQUE SCAN EQSZ_PK 1
INDEX (UNIQUE SCAN) EQHT_PK 1
TABLE ACCESS (BY INDE SHIPPING_LINES 1
INDEX (UNIQUE SCAN) LINE_PK 1
INDEX (RANGE SCAN) SEVENTS_TSERV_FK_N 1
TABLE ACCESS (BY INDEX SHIP_VISITS 2
INDEX (RANGE SCAN) SVISIT_UK 2
TABLE ACCESS (BY INDEX R SHIPS 1
INDEX (UNIQUE SCAN) SHIP_PK 1
TABLE ACCESS (BY INDEX RO CARE_VIR_MAP 2
INDEX (UNIQUE SCAN) VIR_VESVOY 1
NESTED LOOPS (OUTER) 117519
NESTED LOOPS () 98158
NESTED LOOPS () 78798
NESTED LOOPS () 78795
NESTED LOOPS () 59432
TABLE ACCESS (FULL) EQUIPMENT_USES 20788
TABLE ACCESS (BY INDE EQUIPMENT_TYPES 1
INDEX (UNIQUE SCAN) EQTP_PK 1
TABLE ACCESS (BY INDEX EQUIPMENT 1
INDEX (RANGE SCAN) EQ_EQUSE_FK 1
INDEX (UNIQUE SCAN) EQHT_PK 1
TABLE ACCESS (BY INDEX R EQUIPMENT_SIZES 1
INDEX (UNIQUE SCAN) EQSZ_PK 1
TABLE ACCESS (BY INDEX RO SHIPPING_LINES 1
INDEX (UNIQUE SCAN) LINE_PK 1can somebody help me regarding this?
Thanks
HassanI would say ..gather stats on 9i/10gfor the required table and indexes , then post the expalin plan.
--Girish -
Frm-40505:ORACLE error: unable to perform query in oracle forms 10g
Hi,
I get error frm-40505:ORACLE error: unable to perform query on oracle form in 10g environment, but the same form works properly in 6i.
Please let me know what do i need to do to correct this problem.
Regards,
PriyaHi everyone,
I have block created on view V_LE_USID_1L (which gives the error frm-40505) . We don't need any updation on this block, so the property 'updateallowed' is set to 'NO'.
To fix this error I modified 'Keymode' property, set it to 'updatable' from 'automatic'. This change solved the problem with frm-40505 but it leads one more problem.
The datablock v_le_usid_1l allows user to enter the text (i.e. updated the field), when the data is saved, no message is shown. When the data is refreshed on the screen, the change done previously on the block will not be seen (this is because the block updateallowed is set to NO), how do we stop the fields of the block being editable?
We don't want to go ahead with this solution as, we might find several similar screens nad its diff to modify each one of them individually. When they work properly in 6i, what it doesn't in 10g? does it require any registry setting?
Regards,
Priya -
Poor performance with Oracle Spatial when spatial query invoked remotely
Is anyone aware of any problems with Oracle Spatial (10.2.0.4 with patches 6989483 and 7003151 on Red Hat Linux 4) which might explain why a spatial query (SDO_WITHIN_DISTANCE) would perform 20 times worse when it was invoked remotely from another computer (using SQLplus) vs. invoking the very same query from the database server itself (also using SQLplus)?
Does Oracle Spatial have any known problems with servers which use SAN disk storage? That is the primary difference between a server in which I see this poor performance and another server where the performance is fine.
Thank you in advance for any thoughts you might share.OK, that's clearer.
Are you sure it is the SQL inside the procedure that is causing the problem? To check, try extracting the SQL from inside the procedure and run it in SQLPLUS with
set autotrace on
set timing on
SELECT ....If the plans and performance are the same then it may be something inside the procedure itself.
Have you profiled the procedure? Here is an example of how to do it:
Prompt Firstly, create PL/SQL profiler table
@$ORACLE_HOME/rdbms/admin/proftab.sql
Prompt Secondly, use the profiler to gather stats on execution characteristics
DECLARE
l_run_num PLS_INTEGER := 1;
l_max_num PLS_INTEGER := 1;
v_geom mdsys.sdo_geometry := mdsys.sdo_geometry(2002,null,null,sdo_elem_info_array(1,2,1),sdo_ordinate_array(0,0,45,45,90,0,135,45,180,0,180,-45,45,-45,0,0));
BEGIN
dbms_output.put_line('Start Profiler Result = ' || DBMS_PROFILER.START_PROFILER(run_comment => 'PARALLEL PROFILE')); -- The comment name can be anything: here it is related to the Parallel procedure I am testing.
v_geom := Parallel(v_geom,10,0.05,1); -- Put your procedure call here
dbms_output.put_line('Stop Profiler Result = ' || DBMS_PROFILER.STOP_PROFILER );
END;
SHOW ERRORS
Prompt Finally, report activity
COLUMN runid FORMAT 99999
COLUMN run_comment FORMAT A40
SELECT runid || ',' || run_date || ',' || run_comment || ',' || run_total_time
FROM plsql_profiler_runs
ORDER BY runid;
COLUMN runid FORMAT 99999
COLUMN unit_number FORMAT 99999
COLUMN unit_type FORMAT A20
COLUMN unit_owner FORMAT A20
COLUMN text FORMAT A100
compute sum label 'Total_Time' of total_time on runid
break on runid skip 1
set linesize 200
SELECT u.runid || ',' ||
u.unit_name,
d.line#,
d.total_occur,
d.total_time,
text
FROM plsql_profiler_units u
JOIN plsql_profiler_data d ON u.runid = d.runid
AND
u.unit_number = d.unit_number
JOIN all_source als ON ( als.owner = 'CODESYS'
AND als.type = u.unit_type
AND als.name = u.unit_name
AND als.line = d.line# )
WHERE u.runid = (SELECT max(runid) FROM plsql_profiler_runs)
ORDER BY d.total_time desc;Run the profiler in both environments and see if you can see where the slowdown exists.
regards
Simon -
Fast query in Oracle 10 but slow in Oracle 11
Hello all,
We have a query that is running smooth in Oracle 10g. It takes less then a second. We have setup a second server and used export/import to create the same database on 11g. On this 11g database the query takes a lot of time (like 8s or more).
Below are the details. Maybe somebody can point us to the reason why this happens.
We are talking about this statement :
Select nvl(sum(BM_OPENST_D - BM_OPENST_CR),0)
from bh.bh123gh
where
F123_AR_NR>='4400000000' and
F123_AR_NR<='4404000000' and
F123_KL_LEV_AR_NR='0631001000' and
SRT_REK=2 and
F123_BKJR>=0000 and
F123_BKJR<=2011 and
F123_FIRMA=2;Database version is 11.2.0.1.0
SQL>
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.2.0.1
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
optimizer_use_invisible_indexes boolean FALSE
optimizer_use_pending_statistics boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL>
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 6
SQL>
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL>
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL>
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL>
SQL> select sname
2 , pname
3 , pval1
4 , pval2
5 from
6 sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 03-30-2010 11:05
SYSSTATS_INFO DSTOP 03-30-2010 11:05
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 1183.90219
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.
Elapsed: 00:00:00.03
SQL>
SQL> explain plan for
2 Select nvl(sum(BM_OPENST_DEB - BM_OPENST_CR),0)
3 from bh.bh123gh
4 where
5 F123_AR_NR>='4400000000' and
6 F123_AR_NR<='4404000000' and
7 F123_KL_LEV_AR_NR='0631001000' and
8 SRT_REK=2 and
9 F123_BKJR>=0000 and
10 F123_BKJR<=2011 and
11 F123_FIRMA=2;
Explained.
Elapsed: 00:00:00.10
SQL>
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3488495774
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 38 | 1792 (1)| 00:00:22 |
| 1 | SORT AGGREGATE | | 1 | 38 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 5059 | 187K| 1792 (1)| 00:00:22 |
|* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 5059 | | 145 (0)| 00:00:02 |
Predicate Information (identified by operation id):
2 - filter("F123_BKJR">=0000 AND "F123_BKJR"<=2011)
3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000'
AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000')
filter("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000')
18 rows selected.
Elapsed: 00:00:00.20
SQL>
SQL> rollback;
Rollback complete.
Elapsed: 00:00:00.01
SQL>
SQL> rem Set the ARRAYSIZE according to your application
SQL> set autotrace traceonly arraysize 100
SQL>
SQL> alter session set tracefile_identifier = 'mytrace1';
Session altered.
Elapsed: 00:00:00.01
SQL>
SQL> rem if you're using bind variables
SQL> rem define them here
SQL>
SQL> rem variable b_var1 number
SQL> rem variable b_var2 varchar2(20)
SQL>
SQL> rem and initialize them
SQL>
SQL> rem exec :b_var1 := 1
SQL> rem exec :b_var2 := 'DIAG'
SQL>
SQL> alter session set events '10046 trace name context forever, level 8';
Session altered.
Elapsed: 00:00:00.03
SQL>
SQL> -- put your statement here
SQL> Select nvl(sum(BM_OPENST_D - BM_OPENST_CR),0)
2 from bh.bh123gh
3 where
4 F123_AR_NR>='4400000000' and
5 F123_AR_NR<='4404000000' and
6 F123_KL_LEV_AR_NR='0631001000' and
7 SRT_REK=2 and
8 F123_BKJR>=0000 and
9 F123_BKJR<=2011 and
10 F123_FIRMA=2;
Elapsed: 00:00:09.92
Execution Plan
Plan hash value: 3488495774
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 38 | 1792 (1)| 00:00:22 |
| 1 | SORT AGGREGATE | | 1 | 38 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 5059 | 187K| 1792 (1)| 00:00:22 |
|* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 5059 | | 145 (0)| 00:00:02 |
Predicate Information (identified by operation id):
2 - filter("F123_BKJR">=0000 AND "F123_BKJR"<=2011)
3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000'
AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000')
filter("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000')
Statistics
1 recursive calls
0 db block gets
11104 consistent gets
9434 physical reads
0 redo size
574 bytes sent via SQL*Net to client
519 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
SQL> disconnect
Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
SQL>
SQL> spool offTrace output :
TKPROF: Release 11.2.0.1.0 - Development on Tue Nov 22 13:58:33 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Trace file: C:\Oracle\diag\rdbms\oravopak\oravopak\trace\oravopak_ora_7352_mytrace1.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
Select nvl(sum(BM_OPENST_D - BM_OPENST_CR),0)
from bh.bh123gh
where
F123_AR_NR>='4400000000' and
F123_AR_NR<='4404000000' and
F123_KL_LEV_AR_NR='0631001000' and
SRT_REK=2 and
F123_BKJR>=0000 and
F123_BKJR<=2011 and
F123_FIRMA=2
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.03 9.86 9434 11104 0 1
total 4 0.04 9.87 9434 11104 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Rows Row Source Operation
1 SORT AGGREGATE (cr=11104 pr=9434 pw=0 time=0 us)
67250 TABLE ACCESS BY INDEX ROWID BH123GH (cr=11104 pr=9434 pw=0 time=10500177 us cost=1792 size=192242 card=5059)
67250 INDEX RANGE SCAN I_BH123GH_ISABEL (cr=526 pr=550 pw=0 time=44363 us cost=145 size=0 card=5059)(object id 75061)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
Disk file operations I/O 1 0.00 0.00
db file sequential read 8893 0.10 9.26
db file scattered read 7 0.01 0.05
db file parallel read 1 0.02 0.02
SQL*Net message from client 2 0.00 0.00
********************************************************************************DBMS_XPLAN.DISPLAY_CURSOR output :
SQL>
SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID g6pkv639sdfgw, child number 0
Select /*+ gather_plan_statistics */ nvl(sum(BM_OPENST_DEB -
BM_OPENST_CR),0) from bh.bh123gh where F123_AR_NR>='4400000000'
and F123_AR_NR<='4404000000' and F123_KL_LEV_AR_NR='0631001000' and
SRT_REK=2 and F123_BKJR>=0000 and F123_BKJR<=2011 and
F123_FIRMA=2
Plan hash value: 3488495774
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
| 0 | SELECT STATEMENT | | 1 | | 1 |00:00:08.07 | 11104 | 13531 |
| 1 | SORT AGGREGATE | | 1 | 1 | 1 |00:00:08.07 | 11104 | 13531 |
|* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 1 | 5059 | 67250 |00:00:10.90 | 11104 | 13531 |
|* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 1 | 5059 | 67250 |00:00:00.05 | 526 | 550 |
Predicate Information (identified by operation id):
2 - filter(("F123_BKJR">=0 AND "F123_BKJR"<=2011))
3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000' AND
"F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000')
filter(("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000'))
27 rows selected.
Elapsed: 00:00:01.15
SQL>
SQL> spool offI still find that my Oracle 10 DB is a tad faster.
Comparing the plans shows that my Oracle 10 DB does less physical reads. I think I will get the same speed if I can find a way to change that behaviour on my Oracle 11 DB or can find the reason why it does that.
SQL>
SQL> show parameter user_dump_dest
NAME TYPE VALUE
user_dump_dest string C:\ORACLE\PRODUCT\10.2.0\ADMIN
\ORAMULT\UDUMP
SQL>
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.2.0.3
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
SQL>
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 16
SQL>
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL>
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL>
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL>
SQL> select sname
2 , pname
3 , pval1
4 , pval2
5 from
6 sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 04-17-2007 04:50
SYSSTATS_INFO DSTOP 04-17-2007 04:50
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 470.445344
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.
Elapsed: 00:00:00.01
SQL>
SQL> explain plan for
2 Select nvl(sum(BM_OPENST_DEB- BM_OPENST_CR),0)
3 from bh.bh123gh
4 where
5 F123_AR_NR>='4400000000' and
6 F123_AR_NR<='4404000000' and
7 F123_KL_LEV_AR_NR='0631001000' and
8 SRT_REK=2 and
9 F123_BKJR>=0000 and
10 F123_BKJR<=2011 and
11 F123_FIRMA=2;
Explained.
Elapsed: 00:00:00.00
SQL>
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3488495774
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 38 | 1594 (1)| 00:00:20 |
| 1 | SORT AGGREGATE | | 1 | 38 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 4776 | 177K| 1594 (1)| 00:00:20 |
|* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 4776 | | 140 (1)| 00:00:02 |
Predicate Information (identified by operation id):
2 - filter("F123_BKJR">=0000 AND "F123_BKJR"<=2011)
3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000'
AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000')
filter("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000')
18 rows selected.
Elapsed: 00:00:00.32
SQL>
SQL> rollback;
Rollback complete.
Elapsed: 00:00:00.00
SQL>
SQL> rem Set the ARRAYSIZE according to your application
SQL> set autotrace traceonly arraysize 100
SQL>
SQL> alter session set tracefile_identifier = 'mytrace1';
Session altered.
Elapsed: 00:00:00.00
SQL>
SQL> rem if you're using bind variables
SQL> rem define them here
SQL>
SQL> rem variable b_var1 number
SQL> rem variable b_var2 varchar2(20)
SQL>
SQL> rem and initialize them
SQL>
SQL> rem exec :b_var1 := 1
SQL> rem exec :b_var2 := 'DIAG'
SQL>
SQL> alter session set events '10046 trace name context forever, level 8';
Session altered.
Elapsed: 00:00:00.00
SQL>
SQL> -- put your statement here
SQL> Select nvl(sum(BM_OPENST_DEB- BM_OPENST_CR),0)
2 from bh.bh123gh
3 where
4 F123_AR_NR>='4400000000' and
5 F123_AR_NR<='4404000000' and
6 F123_KL_LEV_AR_NR='0631001000' and
7 SRT_REK=2 and
8 F123_BKJR>=0000 and
9 F123_BKJR<=2011 and
10 F123_FIRMA=2;
Elapsed: 00:00:00.12
Execution Plan
Plan hash value: 3488495774
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 38 | 1594 (1)| 00:00:20 |
| 1 | SORT AGGREGATE | | 1 | 38 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 4776 | 177K| 1594 (1)| 00:00:20 |
|* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 4776 | | 140 (1)| 00:00:02 |
Predicate Information (identified by operation id):
2 - filter("F123_BKJR">=0000 AND "F123_BKJR"<=2011)
3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000'
AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000')
filter("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000')
Statistics
1 recursive calls
0 db block gets
11001 consistent gets
0 physical reads
0 redo size
459 bytes sent via SQL*Net to client
396 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
SQL> disconnect
Disconnected from Oracle Database 10g Release 10.2.0.3.0 - Production
SQL>
SQL> spool off -
Hello, I have this problem,
I use php for read data from oracle table,
all works right, I have any problem whith varchar number type data, but when I must read geometry data like
(type MDSYS.SDO_GEOMETRY)
I can't display it on the web page.
esemple of spatial query that I use:
select GEOMETRY_1
from table_a
where
ID = 970;
If I use sql plus I have this result
SDO_GEOMETRY(3001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, -0, -
0, 580094, 4998494, -1))
but blank page when I use php sentence.
I use PHP Version 4.4.0
modules load are:
extension=php_sdo.dll
extension=php_oci8.dll
But I don't know which other module I need and also which php function to use for read array of array. at the moment I use @OCIFetchInto.
Someone can help me?
My English is very bad please reply easy.
Thanks for all!
AngeloThank you very much CJ.
Now there isn't any problems: you and this link (Re: PHP and spatial data and Adamo Bozzetti helped me
I have used SDO_UTIL.GETVERTICES
my complete php script is:
$conn = @OCILogon("xxxxxx", "xxxxx", "xxxxx") or die
( "Non riesco a connettermi al server $host ");
$query = "select
TABLE_A.tipo_via,
TABLE_A.nome_via,
c.codice_via,
t.X,
t.Y
from TABLE B c, TABLE_A , TABLE(SDO_UTIL.GETVERTICES(c.geometry1)) t
where c.codice_via = 830
and c.codice_via = TABLE_A.id_via
$istruzione = @OCIParse($conn, $query);
@OCIExecute($istruzione);
$nrows = @OCIFetchInto($istruzione, $results);
$trovati = 0;
while(@OCIFetchInto($istruzione, $results))
$trovati++;
?>
<table border width="800" >
<tr>
<td align="center" width="80" bgcolor ="#aaffee"><?echo trim($results[0]);?></td>
<td align="center" width="150" bgcolor ="#eeffee"><?echo trim($results[1]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[2]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[3]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[4]);?></td>
</tr>
</table>
<?
} //fine While
@OCIFreeStatement($istruzione);
@OCILogOff($conn); -
10G bug: Simple query terminate oracle session in 10g
The following query fails because it terminates the connection to the oracle database. This only occurs in 10g and Oracle XE. Below that query is the structure of the table and sql statements to populate the table.
I got this from a friend who tried to use 10g, but had to upgrade to Oracle 9 :-) I tested it with Oracle XE. Same problem with 10g and XE. We both use fully patched Windows XP professional.
greetings
SELECT ID_LEVSVIKTPOT
FROM T_RISA_LEVSVIKTPOT
WHERE KRITISK_FORBRUKER = -1;
---- 8< data definition 8< ----
CREATE TABLE T_RISA_LEVSVIKTPOT
ID_LEVSVIKTPOT INTEGER DEFAULT 0 NOT NULL,
NAVN VARCHAR2(50 BYTE),
LT INTEGER DEFAULT 0,
GT INTEGER DEFAULT 0,
KRITISK_FORBRUKER INTEGER DEFAULT -1 NOT NULL
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
NOMONITORING;
ALTER TABLE T_RISA_LEVSVIKTPOT ADD (
CHECK (Kritisk_Forbruker = 0 or Kritisk_Forbruker = -1),
PRIMARY KEY
(ID_LEVSVIKTPOT));
INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
KRITISK_FORBRUKER ) VALUES (
1, '< 10 MW', 10, 0, 0);
INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
KRITISK_FORBRUKER ) VALUES (
2, '10 - 1000 MV', 1000, 10, 0);
INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
KRITISK_FORBRUKER ) VALUES (
3, '> 1000 MV og/eller kritisk forbruker', -1, 1000, -1);
commit;Could not reproduce on my 10gR2 system. What error are you getting and is a trace file produced?
test@ORCL> CREATE TABLE T_RISA_LEVSVIKTPOT
2 (
3 ID_LEVSVIKTPOT INTEGER DEFAULT 0 NOT NULL,
4 NAVN VARCHAR2(50 BYTE),
5 LT INTEGER DEFAULT 0,
6 GT INTEGER DEFAULT 0,
7 KRITISK_FORBRUKER INTEGER DEFAULT -1 NOT NULL
8 )
9 TABLESPACE USERS
10 PCTUSED 0
11 PCTFREE 10
12 INITRANS 1
13 MAXTRANS 255
14 STORAGE (
15 INITIAL 64K
16 MINEXTENTS 1
17 MAXEXTENTS 2147483645
18 PCTINCREASE 0
19 BUFFER_POOL DEFAULT
20 )
21 LOGGING
22 NOCOMPRESS
23 NOCACHE
24 NOPARALLEL
25 NOMONITORING;
Table created.
Elapsed: 00:00:00.35
test@ORCL>
test@ORCL> ALTER TABLE T_RISA_LEVSVIKTPOT ADD (
2 CHECK (Kritisk_Forbruker = 0 or Kritisk_Forbruker = -1),
3 PRIMARY KEY
4 (ID_LEVSVIKTPOT));
Table altered.
Elapsed: 00:00:00.21
test@ORCL> INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
2 KRITISK_FORBRUKER ) VALUES (
3 1, '< 10 MW', 10, 0, 0);
1 row created.
Elapsed: 00:00:00.01
test@ORCL> INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
2 KRITISK_FORBRUKER ) VALUES (
3 2, '10 - 1000 MV', 1000, 10, 0);
1 row created.
Elapsed: 00:00:00.01
test@ORCL> INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
2 KRITISK_FORBRUKER ) VALUES (
3 3, '> 1000 MV og/eller kritisk forbruker', -1, 1000, -1);
1 row created.
Elapsed: 00:00:00.00
test@ORCL> commit;
Commit complete.
Elapsed: 00:00:00.00
test@ORCL> SELECT ID_LEVSVIKTPOT
2 FROM T_RISA_LEVSVIKTPOT
3 WHERE KRITISK_FORBRUKER = -1;
ID_LEVSVIKTPOT
3
Elapsed: 00:00:00.00
test@ORCL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
Elapsed: 00:00:00.03
test@ORCL> -
Query execution taking longer time in Oracle form 10g !!
Hi,
I'm generating a report through Oracle form ( forms 10g) and its taking 3-4 hours to finish. But when I run the same report query in (Oracle 11g) database, it gets executed in less than 40 mins.
The form takes only from and to date as input.
I tried hardcoring the date in the Oracle Form and then the report takes only 40 mins to generate.
I tried various approaches like changing the datatypes of form variable and correspondingly changing the query, but met with no success.
When the report in run through the form , we can see the query getting run in backend for nearly 3 hrs !!! tats really confusing !!
Please let me know, if anybody got any idea on this problem??Hi,
Even I am facing the same problem above. I am trying to fetch results from a cursor which has subquery running over the db link and placing the results set in a csv file using client_io package. When I run the cursor directly from database (11G), it takes not more than 3-4 min to get the results back. But when I run the same cursor via oracle forms 10G, the query in local database keep on waiting for hours to get results from remote database with "SQL*Net message from dblink". Session on local database remains in active status with state as "Waiting" while the session on remote database goes inactive with state as waiting for event "SQL*Net message from client"
This is confusing me since the same query when ran directly from backend fetches results soon.
Please let me know if anyone can help here
Thanks
Garima -
Slow Problems with Oracle Forms 10g and Oracle Database 11g
Hi, I wonder if there is a compatibility problem between Version 10.1.2.0.2 32 Oracle Forms and Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production. This is because my application runs correctly on a version of Oracle Database 10g, and when we migrated the database to an Oracle Database 11g, slowness problems came out.
Thanks.We have the same issue happening with our custom forms and with some of the standard forms in EBSO. So far we have found that the form invoking a view causes ridiculous slowness in opening the form (40 mins). Using a table access has shortened the open time significantly. At this time Oracle DBAs at OOD have no clear idea why it is happening.
we are on 11.1 database with 11.5 EBSO
Edited by: user3223867 on Feb 4, 2011 7:55 AM -
Oracle spatial query SDO_LRS with php
Hello, I have this problem,
I use php for read data from oracle table.
I know I can't show on web page the result of SDO_ORDINATE_ARRAY
Christopher Jones has written that I must use SDO_UTIL.GETVERTICES like as
select
t.X,
t.Y
from table_a, TABLE(SDO_UTIL.GETVERTICES(table_a.GEOMETRY_1)) t
where
id_num = 970;
But now I must read a projection point ordinate of a point with respect to a geometric segment
and the same problem come back.
esemple of spatial query that I use:
SELECT
SDO_LRS.PROJECT_PT(geometry,
SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(580094.69, 4998493.68, NULL)) )
FROM
TABLE_B
WHERE
ID_CODE = 970;
If I use sql plus I have this result
SDO_LRS.PROJECT_PT(GEOMETRY,SD(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM
SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
580093,325, 4998497,57, 45,2254405))
Which is exacly the query for extract these coordinates?
Someone can help me?
My English is very bad please reply easy.
Thanks for all!
AngeloHello thanks for all to everyboby.
I put the same question on Forum /Category/Database/Spatial and I have received this reply
from Brian Camire, this query worked well.
SELECT
T.X,
T.Y
FROM
TABLE
SELECT
SDO_UTIL.GETVERTICES
SDO_LRS.PROJECT_PT
GEOMETRY,
SDO_GEOMETRY
3301,
NULL,
NULL,
SDO_ELEM_INFO_ARRAY(1, 1, 1),
SDO_ORDINATE_ARRAY(580093.859, 4998493.5, NULL)
FROM
TABLE_B
WHERE
ID_CODE = 970
) T;
Best regards
Angelo. -
Oracle 8i giving slow response when running sql query
hi ,
i am using oracle 8i server ;
and sql query giving slow response before some days;
so which parameter need to increase
DB_BLOCK_BFFERS OR SHARE_POOL_SIZE
CURRENT SETING IS
DB_BLOCK_BUFFER=256000;
SHARE POOLSIZE=300M;
pls advice to me
thanksNo parameters need to be increased. Tuning is not done but making arbitrary changes to values and hoping that good things will happen by accident.
The thing you really should be worrying about is your antique database and likely its impact on your skill set unless you are one year away from retirement.
Where's the actual version number?
Where's the DDL?
Where's the DML?
Where's the Explain Plan? -
Spatial query w/ logical operators in a subquery on Linux using Oracle 1
Hello...
I'm being given XML that I need to parse and create SQL from it. Below my signature is the SQL that I generate (its a simple example) and can be more elaborate due to the logical operators (AND and OR) given in the XML.
The problem that we're seeing is performance-based: when one of the logical operator queries is Spatial-based, like below. Running it in JDBC, the query never returns.
The spatial query just by itself returns ~300 rows (takes approximately 0.2 seconds). The "PERCENTAGE" query by itself returns about ~40000 rows (takes approximately ~.8 seconds).
If we run the query below with 2 non-spatial subqueries, the result returns and performance is very acceptable (~ 0.9 seconds)-- the result set is about 80000 rows.
Thanks,
Jim
=========================
SELECT
COLUMN_WE_WANT , RESULTS
FROM
TABLE_A
WHERE
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_A
WHERE
SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,
SDO_GEOMETRY(2003,
4326,
null,
SDO_elem_info_array( 1 , 3 , 1 ),
SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 )
) = 'TRUE'
OR
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_B
WHERE
SOME_PERCENTAGE_RATE_COLUMN < 90
)Its difficult to comment without seeing the execution plan. You should trace this query to get a better idea of exactly what's happening.
Depending on the complexity of the logical operators, I would look at doing this using set operations. So for an OR you might have...
SELECT COLUMN_WE_WANT, RESULTS
FROM TABLE_A
WHERE COLUMN_WE_WANT IN (
SELECT COLUMN_WE_WANT
FROM TABLE_A
WHERE SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,SDO_GEOMETRY(2003,4326,
NULL, SDO_elem_info_array( 1 , 3 , 1 ),
SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 ) )) = 'TRUE'
UNION
SELECT COLUMN_WE_WANT
FROM TABLE_B
WHERE SOME_PERCENTAGE_RATE_COLUMN < 90)For an AND, you would use INTERSECT.
Edited by: Reggie to remove the extra INTERSECT -
Oracle Spatial Query from SQLPLUS deteriorates in performance
Hi,
I am running an sql-procedure, which does spatial queries. When I run this procedure (from SQLPLUS) for the first time it takes around 45 sec to complete, but when I run the same procedure for the second time it takes 65 seconds and the performance keeps on decreasing. But if I open a new SQLPLUS session it takes 45 secs and it also starts deteriorating subsequently. This strange behaviour is only for spatial queries, if I don't have spatial queries in my procedure then its fine.
I found this behaviour for any type of spatial query.
Is there something which can be done for improving it ? I found a lot of information on improving performance of a query, but my problem is to maintain the same performance of the same query in the same session.
Thanks,
RishiHi,
Could you provide version information?
Also, could you try monitoring memory as the procedure is running an see
if memory climbs more each time the procedure is run?
Thanks
Maybe you are looking for
-
EXCEL.EXE process is keep running even after closing all the handles
I am using Excel Report Instrument functions for creating excel application and sheet,workbook after reading/writing in to excel file am closing all the handles using CA_DiscardObjHandle (handle); even after file is getting closed m checking it
-
Warning when launching Aperture
Hi, I recently updated to Mavericks, and Aperture and Iphoto got updated too. I opened my library with Iphoto and everything works fine. I tried to open the same library with Aperture and got this Warning: Repeated crashes can indicate an inconsisten
-
Iphoto won't import photos and application won't stop working
Recently, when I have tried to import photos from my card reader the iphoto application appears to be working to locate the pictures but it freezes. It won't respond to the "Quit" function, window won't close, can't eject my device. The only way to
-
Moving SPL in small values, how to ?
Hi Forum How to get my SPL to move in the from transport set value? I can only get it to move in bars!! It seems to be a keyboard layout problem maybe only concerning foreigners using different keyboard layouts ?! yours fan Bo
-
I have downloaded the Premiere 10 trial and run the exe file in...\Adobe Premiere Elements 10\PRE 10\ElementsSTIInstaller, However, I can not find the program on my computer. Can you please tell me the procedure to install the program following the