SELECTing from a large table vs small table
I posted a question few months back about teh comparison between INSERTing to a large table vs small table ( fewer number of rows ), in terms of time taken.
The general consensus seemed to be that it would be teh same, except for teh time taken to update the index ( which will be negligible ).
1. But now, following teh same logic, I m confused why SELECTINg from a large table should be more time taking ("expensive" ) than SELECTing from a small table.
( SELECTing using an index )
My understanding of how Oracle works internally is this :
It will first locate the ROWID from teh B-Tree that stores the index.
( This operation is O(log N ) based on B-Tree )
ROWID essentially contains teh file pointer offset of teh location of the data in teh disk.
And Oracle simply reads teh data from teh location it deduced from ROWID.
But then the only variable I see is searching teh B-Tree, which should take O(log N ) time for comparison ( N - number of rows )
Am I correct above.
2. Also I read that tables are partitioned for performance reasons. I read about various partiotion mechanisms. But cannot figure out how it can result in performance improvement.
Can somebody please help
user597961 wrote:
I posted a question few months back about teh comparison between INSERTing to a large table vs small table ( fewer number of rows ), in terms of time taken.
The general consensus seemed to be that it would be teh same, except for teh time taken to update the index ( which will be negligible ).
1. But now, following teh same logic, I m confused why SELECTINg from a large table should be more time taking ("expensive" ) than SELECTing from a small table.
( SELECTing using an index )
My understanding of how Oracle works internally is this :
It will first locate the ROWID from teh B-Tree that stores the index.
( This operation is O(log N ) based on B-Tree )
ROWID essentially contains teh file pointer offset of teh location of the data in teh disk.
And Oracle simply reads teh data from teh location it deduced from ROWID.
But then the only variable I see is searching teh B-Tree, which should take O(log N ) time for comparison ( N - number of rows )
Am I correct above.
2. Also I read that tables are partitioned for performance reasons. I read about various partiotion mechanisms. But cannot figure out how it can result in performance improvement.
Can somebody please helpIt's not going to be that simple. Before your first step (locate ROWID from index), it will first evaluate various access plans - potentially thousands of them - and choose the one that it thinks will be best. This evaluation will be based on the number of rows it anticipates having to retrieve, whether or not all of the requested data can be retrived from the index alone (without even going to the data segment), etc. etc etc. For each consideration it makes, you start with "all else being equal". Then figure there will be dozens, if not hundreds or thousands of these "all else being equal". Then once the plan is selected and the rubber meets the road, we have to contend with the fact "all else is hardly ever equal".
Similar Messages
-
Subtract a workpath selection from a larger workpath
my job prohibits me from sharing images so if needed i can make a quick sketch if i can't get my question across clear enough.
here is what i have.
the image is a stack of objects and i have made a work path of all the objects (one large selection labeled "All" around all objects to isolate away from background), then i have another work path of just the bottom object (labeled "Bottom").
my goal.
i do this quite often, so i'd like to be able to just subtract the "bottom" work path selection from the larger "All" work path selection.
Thanks
p.s. i tried all the FAQ and search before posting.Thanks, I knew there was a quick command for that, I searched and searched and couldn't find it.. I have done it before too, just not in a while. As for the deleting layer content, i agree for the most part but in this case it doesn't matter in this case since I only end up with one (all original from the photographer) layer at the end and don't save in a format that supports masks.
Thanks for your quick response and helping me make an easy and more accurate work path! -
Poor performance while join of 2 comprehensive large views and small table
Hi,
The following SQL statement has been identified to perform poorly. It currently takes up to 6 seconds to execute, but it's supposed to take ~30-40ms at most.
This is the statement(all bind variables change to numbers):
SELECT v__96.connector_objectid, v__96.connector_classid, v__96.from_objectid,
v__96.to_objectid, v__96.from_classid, v__96.to_classid,
v__96.from_firstunit, v__96.to_firstunit, v__96.number_of_units,
tmp_trace.first_unit, tmp_trace.last_unit, v__96.inv_status_number,
tmp_trace.first_unit, tmp_trace.last_unit, v__96.answers,
v__96.priority, v__97.first_unit, v__97.n_units,
v__97.mid_span_distance
FROM ne.tmp_trace,
(SELECT b.objectid, b.answers, b.connector_classid,
b.connector_objectid, b.from_classid, b.from_objectid,
b.to_classid, b.to_objectid, b.from_firstunit, b.to_firstunit,
b.number_of_units, b.inv_status_number, b.splice_closure_name,
b.work_order_name, b.work_order_item_number,
b.inventory_status_code, b.priority
FROM ne.connection b
WHERE b.objectid NOT IN (
SELECT /*+ HASH_AJ */
sde_deletes_row_id
FROM ne.d96
WHERE deleted_at IN (
SELECT l.lineage_id
FROM sde.state_lineages l
WHERE l.lineage_name = 2
AND l.lineage_id <= 115)
AND sde_state_id = 0)
UNION ALL
SELECT a.objectid, a.answers, a.connector_classid,
a.connector_objectid, a.from_classid, a.from_objectid,
a.to_classid, a.to_objectid, a.from_firstunit, a.to_firstunit,
a.number_of_units, a.inv_status_number, a.splice_closure_name,
a.work_order_name, a.work_order_item_number,
a.inventory_status_code, a.priority
FROM ne.a96 a, sde.state_lineages sl
WHERE (a.objectid, a.sde_state_id) NOT IN (
SELECT /*+ HASH_AJ */
sde_deletes_row_id, sde_state_id
FROM ne.d96
WHERE deleted_at IN (
SELECT l.lineage_id
FROM sde.state_lineages l
WHERE l.lineage_name = 2
AND l.lineage_id <= 115)
AND sde_state_id > 0)
AND a.sde_state_id = sl.lineage_id
AND sl.lineage_name = 2
AND sl.lineage_id <= 115) v__96,
(SELECT b.objectid, b.tray_number, b.db_loss, b.first_unit, b.n_units,
b.connection_objectid, b.connector_type_name,
b.dedicated_status, b.mid_span_distance
FROM ne.connection_attributes b
WHERE b.objectid NOT IN (
SELECT /*+ HASH_AJ */
sde_deletes_row_id
FROM ne.d97
WHERE deleted_at IN (
SELECT l.lineage_id
FROM sde.state_lineages l
WHERE l.lineage_name = 2
AND l.lineage_id <= 115)
AND sde_state_id = 0)
UNION ALL
SELECT a.objectid, a.tray_number, a.db_loss, a.first_unit, a.n_units,
a.connection_objectid, a.connector_type_name,
a.dedicated_status, a.mid_span_distance
FROM ne.a97 a, sde.state_lineages sl
WHERE (a.objectid, a.sde_state_id) NOT IN (
SELECT /*+ HASH_AJ */
sde_deletes_row_id, sde_state_id
FROM ne.d97
WHERE deleted_at IN (
SELECT l.lineage_id
FROM sde.state_lineages l
WHERE l.lineage_name = 2
AND l.lineage_id <= 115)
AND sde_state_id > 0)
AND a.sde_state_id = sl.lineage_id
AND sl.lineage_name = 2
AND sl.lineage_id <= 115) v__97
WHERE ( ( ( ( ( ( ne.tmp_trace.equipment_object_id =
v__96.to_objectid
AND v__96.to_classid = 9
OR ( ne.tmp_trace.transmedia_object_id =
v__96.to_objectid
AND v__96.to_classid = 5
AND ( (v__96.to_firstunit
BETWEEN ne.tmp_trace.first_unit
AND ne.tmp_trace.last_unit
OR (ne.tmp_trace.first_unit
BETWEEN v__96.to_firstunit
AND v__96.to_firstunit
+ v__96.number_of_units
- 1
AND v__96.answers = 0
AND v__96.objectid = v__97.connection_objectid
AND (ne.tmp_trace.session_id = -1234)
);It should return many values from 2 comprehensive views (v__96, v__97) and business table (tmp_trace). 2 comprehensive views ~1,000,000 recs each, business table ~ 10 recs.
The version of the database is 11.1.0.6.
These are the parameters relevant to the optimizer:
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.1.0.6
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> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 128
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string FORCE
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL> select sname, pname, pval1, pval2 from sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 07-15-2009 10:27
SYSSTATS_INFO DSTOP 07-15-2009 10:27
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 1812.32129
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SNAME PNAME PVAL1 PVAL2
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.Here is the output of EXPLAIN PLAN:
explain plan for -- statement above
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1005186751
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 282 | 268 (2)| 00:00:04 |
| 1 | NESTED LOOPS | | 1 | 282 | 268 (2)| 00:00:04 |
| 2 | MERGE JOIN CARTESIAN | | 1 | 119 | 260 (1)| 00:00:04 |
|* 3 | TABLE ACCESS FULL | TMP_TRACE | 1 | 65 | 2 (0)| 00:00:01 |
| 4 | BUFFER SORT | | 103K| 5467K| 258 (1)| 00:00:04 |
| 5 | VIEW | | 103K| 5467K| 258 (1)| 00:00:04 |
| 6 | UNION-ALL | | | | | |
| 7 | NESTED LOOPS ANTI | | 1 | 82 | 3 (0)| 00:00:01 |
| 8 | TABLE ACCESS FULL | CONNECTION_ATTRIBUTES | 1 | 78 | 2 (0)| 00:00:01 |
| 9 | VIEW PUSHED PREDICATE | VW_NSO_1 | 1 | 4 | 1 (0)| 00:00:01 |
| 10 | NESTED LOOPS | | 1 | 20 | 1 (0)| 00:00:01 |
|* 11 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 12 | INDEX UNIQUE SCAN | D97_PK | 1 | 13 | 0 (0)| 00:00:01 |
|* 13 | HASH JOIN RIGHT ANTI | | 103K| 5568K| 255 (1)| 00:00:04 |
| 14 | VIEW | VW_NSO_2 | 1 | 26 | 2 (0)| 00:00:01 |
| 15 | NESTED LOOPS | | 1 | 20 | 2 (0)| 00:00:01 |
|* 16 | INDEX FAST FULL SCAN | D97_PK | 1 | 13 | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | | | | |
| 19 | NESTED LOOPS | | 103K| 2936K| 252 (1)| 00:00:04 |
|* 20 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 21 | INDEX RANGE SCAN | A97_STATEID_IX1 | 17731 | | 32 (0)| 00:00:01 |
| 22 | TABLE ACCESS BY INDEX ROWID| A97 | 21491 | 461K| 123 (1)| 00:00:02 |
|* 23 | VIEW | | 1 | 163 | 8 (13)| 00:00:01 |
| 24 | UNION ALL PUSHED PREDICATE | | | | | |
| 25 | NESTED LOOPS ANTI | | 1 | 185 | 1 (0)| 00:00:01 |
|* 26 | TABLE ACCESS BY INDEX ROWID | CONNECTION | 1 | 181 | 0 (0)| 00:00:01 |
|* 27 | INDEX UNIQUE SCAN | R96_SDE_ROWID_UK | 1 | | 0 (0)| 00:00:01 |
| 28 | VIEW PUSHED PREDICATE | VW_NSO_3 | 1 | 4 | 1 (0)| 00:00:01 |
| 29 | NESTED LOOPS | | 1 | 20 | 1 (0)| 00:00:01 |
|* 30 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 31 | INDEX UNIQUE SCAN | D96_PK | 1 | 13 | 0 (0)| 00:00:01 |
|* 32 | HASH JOIN ANTI | | 1 | 97 | 7 (15)| 00:00:01 |
| 33 | NESTED LOOPS | | 1 | 71 | 4 (0)| 00:00:01 |
|* 34 | TABLE ACCESS BY INDEX ROWID | A96 | 1 | 64 | 4 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | A96_PK | 1 | | 3 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
| 37 | VIEW | VW_NSO_4 | 1 | 26 | 2 (0)| 00:00:01 |
| 38 | NESTED LOOPS | | 1 | 20 | 2 (0)| 00:00:01 |
|* 39 | INDEX FAST FULL SCAN | D96_PK | 1 | 13 | 2 (0)| 00:00:01 |
|* 40 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - filter("TMP_TRACE"."SESSION_ID"=(-1234))
11 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
12 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
"SDE_STATE_ID"=0)
filter("DELETED_AT"<=115)
13 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
16 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
17 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
filter("L"."LINEAGE_ID"<=115)
20 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
21 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
filter("A"."SDE_STATE_ID"<=115)
23 - filter(("TMP_TRACE"."EQUIPMENT_OBJECT_ID"="V__96"."TO_OBJECTID" AND "V__96"."TO_CLASSID"=9
OR "TMP_TRACE"."TRANSMEDIA_OBJECT_ID"="V__96"."TO_OBJECTID" AND "V__96"."TO_CLASSID"=5) AND
("V__96"."TO_FIRSTUNIT">="TMP_TRACE"."FIRST_UNIT" AND
"V__96"."TO_FIRSTUNIT"<="TMP_TRACE"."LAST_UNIT" OR "TMP_TRACE"."FIRST_UNIT">="V__96"."TO_FIRSTUNIT"
AND "TMP_TRACE"."FIRST_UNIT"<="V__96"."TO_FIRSTUNIT"+"V__96"."NUMBER_OF_UNITS"-1))
26 - filter("B"."ANSWERS"=0)
27 - access("B"."OBJECTID"="V__97"."CONNECTION_OBJECTID")
30 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
31 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
"SDE_STATE_ID"=0)
filter("DELETED_AT"<=115)
32 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
34 - filter("A"."ANSWERS"=0)
35 - access("A"."OBJECTID"="V__97"."CONNECTION_OBJECTID" AND "A"."SDE_STATE_ID"<=115)
36 - access("SL"."LINEAGE_NAME"=2 AND "A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
filter("SL"."LINEAGE_ID"<=115)
39 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND
"SDE_DELETES_ROW_ID"="V__97"."CONNECTION_OBJECTID" AND "SDE_STATE_ID">0)
40 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
filter("L"."LINEAGE_ID"<=115)
Note
- dynamic sampling used for this statement
87 rows selected.Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
SQL> set autotrace traceonly arraysize 100
Elapsed: 00:00:01.64
Execution Plan
Plan hash value: 1198408274
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 876K| 238M| 1301 (2)| 00:00:16 |
| 1 | CONCATENATION | | | | | |
|* 2 | HASH JOIN | | 438K| 119M| 651 (2)| 00:00:08 |
|* 3 | HASH JOIN | | 423 | 98559 | 390 (2)| 00:00:05 |
|* 4 | TABLE ACCESS FULL | TMP_TRACE | 82 | 5330 | 29 (0)| 00:00:01 |
|* 5 | VIEW | | 103K| 16M| 360 (1)| 00:00:05 |
| 6 | UNION-ALL | | | | | |
| 7 | NESTED LOOPS ANTI | | 1 | 185 | 3 (0)| 00:00:01 |
|* 8 | TABLE ACCESS FULL | CONNECTION | 1 | 181 | 2 (0)| 00:00:01 |
| 9 | VIEW PUSHED PREDICATE | VW_NSO_3 | 1 | 4 | 1 (0)| 00:00:01 |
| 10 | NESTED LOOPS | | 1 | 20 | 1 (0)| 00:00:01 |
|* 11 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 12 | INDEX UNIQUE SCAN | D96_PK | 1 | 13 | 0 (0)| 00:00:01 |
|* 13 | HASH JOIN RIGHT ANTI | | 103K| 9820K| 357 (1)| 00:00:05 |
| 14 | VIEW | VW_NSO_4 | 1 | 26 | 2 (0)| 00:00:01 |
| 15 | NESTED LOOPS | | 1 | 20 | 2 (0)| 00:00:01 |
|* 16 | INDEX FAST FULL SCAN | D96_PK | 1 | 13 | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | | | | |
| 19 | NESTED LOOPS | | 103K| 7188K| 354 (1)| 00:00:05 |
|* 20 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 21 | INDEX RANGE SCAN | A96_STATEID_IX1 | 17731 | | 32 (0)| 00:00:01 |
|* 22 | TABLE ACCESS BY INDEX ROWID| A96 | 21491 | 1343K| 224 (1)| 00:00:03 |
| 23 | VIEW | | 103K| 5264K| 258 (1)| 00:00:04 |
| 24 | UNION-ALL | | | | | |
| 25 | NESTED LOOPS ANTI | | 1 | 82 | 3 (0)| 00:00:01 |
| 26 | TABLE ACCESS FULL | CONNECTION_ATTRIBUTES | 1 | 78 | 2 (0)| 00:00:01 |
| 27 | VIEW PUSHED PREDICATE | VW_NSO_1 | 1 | 4 | 1 (0)| 00:00:01 |
| 28 | NESTED LOOPS | | 1 | 20 | 1 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 30 | INDEX UNIQUE SCAN | D97_PK | 1 | 13 | 0 (0)| 00:00:01 |
|* 31 | HASH JOIN RIGHT ANTI | | 103K| 5568K| 255 (1)| 00:00:04 |
| 32 | VIEW | VW_NSO_2 | 1 | 26 | 2 (0)| 00:00:01 |
| 33 | NESTED LOOPS | | 1 | 20 | 2 (0)| 00:00:01 |
|* 34 | INDEX FAST FULL SCAN | D97_PK | 1 | 13 | 2 (0)| 00:00:01 |
|* 35 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
| 36 | NESTED LOOPS | | | | | |
| 37 | NESTED LOOPS | | 103K| 2936K| 252 (1)| 00:00:04 |
|* 38 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 39 | INDEX RANGE SCAN | A97_STATEID_IX1 | 17731 | | 32 (0)| 00:00:01 |
| 40 | TABLE ACCESS BY INDEX ROWID | A97 | 21491 | 461K| 123 (1)| 00:00:02 |
|* 41 | HASH JOIN | | 438K| 119M| 651 (2)| 00:00:08 |
|* 42 | HASH JOIN | | 423 | 98559 | 390 (2)| 00:00:05 |
|* 43 | TABLE ACCESS FULL | TMP_TRACE | 82 | 5330 | 29 (0)| 00:00:01 |
|* 44 | VIEW | | 103K| 16M| 360 (1)| 00:00:05 |
| 45 | UNION-ALL | | | | | |
| 46 | NESTED LOOPS ANTI | | 1 | 185 | 3 (0)| 00:00:01 |
|* 47 | TABLE ACCESS FULL | CONNECTION | 1 | 181 | 2 (0)| 00:00:01 |
| 48 | VIEW PUSHED PREDICATE | VW_NSO_3 | 1 | 4 | 1 (0)| 00:00:01 |
| 49 | NESTED LOOPS | | 1 | 20 | 1 (0)| 00:00:01 |
|* 50 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | D96_PK | 1 | 13 | 0 (0)| 00:00:01 |
|* 52 | HASH JOIN RIGHT ANTI | | 103K| 9820K| 357 (1)| 00:00:05 |
| 53 | VIEW | VW_NSO_4 | 1 | 26 | 2 (0)| 00:00:01 |
| 54 | NESTED LOOPS | | 1 | 20 | 2 (0)| 00:00:01 |
|* 55 | INDEX FAST FULL SCAN | D96_PK | 1 | 13 | 2 (0)| 00:00:01 |
|* 56 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
| 57 | NESTED LOOPS | | | | | |
| 58 | NESTED LOOPS | | 103K| 7188K| 354 (1)| 00:00:05 |
|* 59 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 60 | INDEX RANGE SCAN | A96_STATEID_IX1 | 17731 | | 32 (0)| 00:00:01 |
|* 61 | TABLE ACCESS BY INDEX ROWID| A96 | 21491 | 1343K| 224 (1)| 00:00:03 |
| 62 | VIEW | | 103K| 5264K| 258 (1)| 00:00:04 |
| 63 | UNION-ALL | | | | | |
| 64 | NESTED LOOPS ANTI | | 1 | 82 | 3 (0)| 00:00:01 |
| 65 | TABLE ACCESS FULL | CONNECTION_ATTRIBUTES | 1 | 78 | 2 (0)| 00:00:01 |
| 66 | VIEW PUSHED PREDICATE | VW_NSO_1 | 1 | 4 | 1 (0)| 00:00:01 |
| 67 | NESTED LOOPS | | 1 | 20 | 1 (0)| 00:00:01 |
|* 68 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 69 | INDEX UNIQUE SCAN | D97_PK | 1 | 13 | 0 (0)| 00:00:01 |
|* 70 | HASH JOIN RIGHT ANTI | | 103K| 5568K| 255 (1)| 00:00:04 |
| 71 | VIEW | VW_NSO_2 | 1 | 26 | 2 (0)| 00:00:01 |
| 72 | NESTED LOOPS | | 1 | 20 | 2 (0)| 00:00:01 |
|* 73 | INDEX FAST FULL SCAN | D97_PK | 1 | 13 | 2 (0)| 00:00:01 |
|* 74 | INDEX UNIQUE SCAN | LINEAGES_PK | 1 | 7 | 0 (0)| 00:00:01 |
| 75 | NESTED LOOPS | | | | | |
| 76 | NESTED LOOPS | | 103K| 2936K| 252 (1)| 00:00:04 |
|* 77 | INDEX RANGE SCAN | LINEAGES_PK | 5 | 35 | 1 (0)| 00:00:01 |
|* 78 | INDEX RANGE SCAN | A97_STATEID_IX1 | 17731 | | 32 (0)| 00:00:01 |
| 79 | TABLE ACCESS BY INDEX ROWID | A97 | 21491 | 461K| 123 (1)| 00:00:02 |
Predicate Information (identified by operation id):
2 - access("V__96"."OBJECTID"="V__97"."CONNECTION_OBJECTID")
3 - access("TMP_TRACE"."TRANSMEDIA_OBJECT_ID"="V__96"."TO_OBJECTID")
filter("V__96"."TO_FIRSTUNIT">="TMP_TRACE"."FIRST_UNIT" AND
"V__96"."TO_FIRSTUNIT"<="TMP_TRACE"."LAST_UNIT" OR "TMP_TRACE"."FIRST_UNIT">="V__96"."TO_FIRSTUNIT"
AND "TMP_TRACE"."FIRST_UNIT"<="V__96"."TO_FIRSTUNIT"+"V__96"."NUMBER_OF_UNITS"-1)
4 - filter("TMP_TRACE"."SESSION_ID"=(-1234))
5 - filter("V__96"."TO_CLASSID"=5)
8 - filter("B"."ANSWERS"=0)
11 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
12 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
"SDE_STATE_ID"=0)
filter("DELETED_AT"<=115)
13 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
16 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
17 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
filter("L"."LINEAGE_ID"<=115)
20 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
21 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
filter("A"."SDE_STATE_ID"<=115)
22 - filter("A"."ANSWERS"=0)
29 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
30 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
"SDE_STATE_ID"=0)
filter("DELETED_AT"<=115)
31 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
34 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
35 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
filter("L"."LINEAGE_ID"<=115)
38 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
39 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
filter("A"."SDE_STATE_ID"<=115)
41 - access("V__96"."OBJECTID"="V__97"."CONNECTION_OBJECTID")
42 - access("TMP_TRACE"."EQUIPMENT_OBJECT_ID"="V__96"."TO_OBJECTID")
filter((LNNVL("TMP_TRACE"."TRANSMEDIA_OBJECT_ID"="V__96"."TO_OBJECTID") OR
LNNVL("V__96"."TO_CLASSID"=5)) AND ("V__96"."TO_FIRSTUNIT">="TMP_TRACE"."FIRST_UNIT" AND
"V__96"."TO_FIRSTUNIT"<="TMP_TRACE"."LAST_UNIT" OR "TMP_TRACE"."FIRST_UNIT">="V__96"."TO_FIRSTUNIT"
AND "TMP_TRACE"."FIRST_UNIT"<="V__96"."TO_FIRSTUNIT"+"V__96"."NUMBER_OF_UNITS"-1))
43 - filter("TMP_TRACE"."SESSION_ID"=(-1234))
44 - filter("V__96"."TO_CLASSID"=9)
47 - filter("B"."ANSWERS"=0)
50 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
51 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
"SDE_STATE_ID"=0)
filter("DELETED_AT"<=115)
52 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
55 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
56 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
filter("L"."LINEAGE_ID"<=115)
59 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
60 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
filter("A"."SDE_STATE_ID"<=115)
61 - filter("A"."ANSWERS"=0)
68 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
69 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
"SDE_STATE_ID"=0)
filter("DELETED_AT"<=115)
70 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
73 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
74 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
filter("L"."LINEAGE_ID"<=115)
77 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
78 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
filter("A"."SDE_STATE_ID"<=115)
Note
- dynamic sampling used for this statementThe TKPROF output for this statement looks like the following:
TKPROF: Release 11.1.0.6.0 - Production on Thu Sep 24 09:30:01 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: pro &The TKPROF output for this statement looks like the following:
TKPROF: Release 11.1.0.6.0 - Production on Thu Sep 24 09:30:01 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: problem.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 V__96.CONNECTOR_OBJECTID, V__96.CONNECTOR_CLASSID, V__96.FROM_OBJECTID, V__96.TO_OBJECTID, V__96.FROM_CLASSID, V__96.TO_CLASSID,
V__96.FROM_FIRSTUNIT, V__96.TO_FIRSTUNIT, V__96.NUMBER_OF_UNITS, TMP_TRACE.FIRST_UNIT, TMP_TRACE.LAST_UNIT, V__96.INV_STATUS_NUMBER,
TMP_TRACE.FIRST_UNIT, TMP_TRACE.LAST_UNIT, V__96.ANSWERS, V__96.PRIORITY, V__97.FIRST_UNIT, V__97.N_UNITS, V__97.MID_SPAN_DISTANCE FROM
NE.TMP_TRACE,(SELECT
b.OBJECTID,b.ANSWERS,b.CONNECTOR_CLASSID,b.CONNECTOR_OBJECTID,b.FROM_CLASSID,b.FROM_OBJECTID,b.TO_CLASSID,b.TO_OBJECTID,b.FROM_FIRSTUNIT,b.TO_FIRSTUNIT,b.NUM
BER_OF_UNITS,b.INV_STATUS_NUMBER,b.SPLICE_CLOSURE_NAME,b.WORK_ORDER_NAME,b.WORK_ORDER_ITEM_NUMBER,b.INVENTORY_STATUS_CODE,b.PRIORITY FROM NE.connection b
WHERE b.OBJECTID NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID FROM NE.D96 WHERE DELETED_AT IN (SELECT l.lineage_id FROM SDE.state_lineages l WHERE
l.lineage_name = :"SYS_B_00" AND l.lineage_id <= :"SYS_B_01") AND SDE_STATE_ID = :"SYS_B_02") UNION ALL SELECT
a.OBJECTID,a.ANSWERS,a.CONNECTOR_CLASSID,a.CONNECTOR_OBJECTID,a.FROM_CLASSID,a.FROM_OBJECTID,a.TO_CLASSID,a.TO_OBJECTID,a.FROM_FIRSTUNIT,a.TO_FIRSTUNIT,a.NUM
BER_OF_UNITS,a.INV_STATUS_NUMBER,a.SPLICE_CLOSURE_NAME,a.WORK_ORDER_NAME,a.WORK_ORDER_ITEM_NUMBER,a.INVENTORY_STATUS_CODE,a.PRIORITY FROM NE.A96
a,SDE.state_lineages SL WHERE (a.OBJECTID, a.SDE_STATE_ID) NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID,SDE_STATE_ID FROM NE.D96 WHERE DELETED_AT IN
(SELECT l.lineage_id FROM SDE.state_lineages l WHERE l.lineage_name = :"SYS_B_03" AND l.lineage_id <= :"SYS_B_04") AND SDE_STATE_ID > :"SYS_B_05") AND
a.SDE_STATE_ID = SL.lineage_id AND SL.lineage_name = :"SYS_B_06" AND SL.lineage_id <= :"SYS_B_07") V__96,(SELECT
b.OBJECTID,b.TRAY_NUMBER,b.DB_LOSS,b.FIRST_UNIT,b.N_UNITS,b.CONNECTION_OBJECTID,b.CONNECTOR_TYPE_NAME,b.DEDICATED_STATUS,b.MID_SPAN_DISTANCE FROM
NE.connection_attributes b WHERE b.OBJECTID NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID FROM NE.D97 WHERE DELETED_AT IN (SELECT l.lineage_id FROM
SDE.state_lineages l WHERE l.lineage_name = :"SYS_B_08" AND l.lineage_id <= :"SYS_B_09") AND SDE_STATE_ID = :"SYS_B_10") UNION ALL SELECT
a.OBJECTID,a.TRAY_NUMBER,a.DB_LOSS,a.FIRST_UNIT,a.N_UNITS,a.CONNECTION_OBJECTID,a.CONNECTOR_TYPE_NAME,a.DEDICATED_STATUS,a.MID_SPAN_DISTANCE FROM NE.A97
a,SDE.state_lineages SL WHERE (a.OBJECTID, a.SDE_STATE_ID) NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID,SDE_STATE_ID FROM NE.D97 WHERE DELETED_AT IN
(SELECT l.lineage_id FROM SDE.state_lineages l WHERE l.lineage_name = :"SYS_B_11" AND l.lineage_id <= :"SYS_B_12") AND SDE_STATE_ID > :"SYS_B_13") AND
a.SDE_STATE_ID = SL.lineage_id AND SL.lineage_name = :"SYS_B_14" AND SL.lineage_id <= :"SYS_B_15") V__97 WHERE ((((( (
NE.tmp_trace.equipment_object_id = V__96.to_objectid
AND
V__96.to_classid = :"SYS_B_16"
OR
NE.tmp_trace.transmedia_object_id = V__96.to_objectid
AND
V__96.to_classid = :"SYS_B_17"
)) AND (
(V__96.to_firstunit
BETWEEN NE.tmp_trace.first_unit AND NE.tmp_trace.last_unit)
OR
(NE.tmp_trace.first_unit BETWEEN V__96.to_firstunit
AND V__96.to_firstunit + V__96.number_of_units - :"SYS_B_18")
)) AND V__96.answers = :"SYS_B_19") AND V__96.objectid = V__97.connection_objectid) AND (NE.tmp_trace.session_id =
:"SYS_B_20"))
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 5.98 5.99 0 22652 0 10
total 3 5.98 5.99 0 22652 0 10
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 45
Rows Row Source Operation
10 NESTED LOOPS (cr=22652 pr=0 pw=0 time=654515 us cost=67 size=282 card=1)
10 NESTED LOOPS (cr=22436 pr=0 pw=0 time=653673 us cost=61 size=235 card=1)
10 TABLE ACCESS FULL TMP_TRACE (cr=5 pr=0 pw=0 time=7 us cost=2 size=65 card=1)
10 VIEW (cr=22431 pr=0 pw=0 time=0 us cost=59 size=170 card=1)
1773000 UNION-ALL (cr=22431 pr=0 pw=0 time=93649 us)
0 NESTED LOOPS ANTI (cr=30 pr=0 pw=0 time=0 us cost=3 size=185 card=1)
0 TABLE ACCESS FULL CONNECTION (cr=30 pr=0 pw=0 time=0 us cost=2 size=181 card=1)
0 VIEW PUSHED PREDICATE VW_NSO_3 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=1 size=20 card=1)
0 INDEX RANGE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=1 size=7 card=1)(object id 34021)
0 INDEX UNIQUE SCAN D96_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)(object id 35121)
1773000 HASH JOIN RIGHT ANTI (cr=22401 pr=0 pw=0 time=75084 us cost=56 size=46948 card=484)
0 VIEW VW_NSO_4 (cr=180 pr=0 pw=0 time=0 us cost=2 size=26 card=1)
0 FILTER (cr=180 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=180 pr=0 pw=0 time=0 us cost=2 size=20 card=1)
0 INDEX FAST FULL SCAN D96_PK (cr=180 pr=0 pw=0 time=0 us cost=2 size=13 card=1)(object id 35121)
0 INDEX UNIQUE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=7 card=1)(object id 34021)
1773000 NESTED LOOPS (cr=22221 pr=0 pw=0 time=56155 us)
1773000 NESTED LOOPS (cr=3231 pr=0 pw=0 time=15078 us cost=53 size=34364 card=484)
50 INDEX RANGE SCAN LINEAGES_PK (cr=10 pr=0 pw=0 time=7 us cost=1 size=7 card=1)(object id 34021)
1773000 INDEX RANGE SCAN A96_STATEID_IX1 (cr=3221 pr=0 pw=0 time=6810 us cost=32 size=0 card=1774)(object id 35116)
1773000 TABLE ACCESS BY INDEX ROWID A96 (cr=18990 pr=0 pw=0 time=0 us cost=52 size=82560 card=1290)
10 VIEW (cr=216 pr=0 pw=0 time=0 us cost=7 size=47 card=1)
10 UNION ALL PUSHED PREDICATE (cr=216 pr=0 pw=0 time=0 us)
0 NESTED LOOPS ANTI (cr=1 pr=0 pw=0 time=0 us cost=2 size=82 card=1)
0 TABLE ACCESS BY INDEX ROWID CONNECTION_ATTRIBUTES (cr=1 pr=0 pw=0 time=0 us cost=1 size=78 card=1)
0 INDEX RANGE SCAN GDB_59_CONNECTIO (cr=1 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 34346)
0 VIEW PUSHED PREDICATE VW_NSO_1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=1 size=20 card=1)
0 INDEX RANGE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=1 size=7 card=1)(object id 34021)
0 INDEX UNIQUE SCAN D97_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)(object id 35127)
10 HASH JOIN ANTI (cr=215 pr=0 pw=0 time=0 us cost=5 size=55 card=1)
10 NESTED LOOPS (cr=35 pr=0 pw=0 time=0 us cost=2 size=29 card=1)
10 TABLE ACCESS BY INDEX ROWID A97 (cr=25 pr=0 pw=0 time=0 us cost=2 size=22 card=1)
10 INDEX RANGE SCAN GDB_59_CONNECTIO_A (cr=15 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 35122)
10 INDEX UNIQUE SCAN LINEAGES_PK (cr=10 pr=0 pw=0 time=0 us cost=0 size=7 card=1)(object id 34021)
0 VIEW VW_NSO_2 (cr=180 pr=0 pw=0 time=0 us cost=2 size=26 card=1)
0 FILTER (cr=180 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=180 pr=0 pw=0 time=0 us cost=2 size=20 card=1)
0 INDEX FAST FULL SCAN D97_PK (cr=180 pr=0 pw=0 time=0 us cost=2 size=13 card=1)(object id 35127)
0 INDEX UNIQUE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=7 card=1)(object id 34021)
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
SQL*Net message from client 2 0.00 0.00After manually rewrite query in TOAD it produces nested loops on business table and than access v__96, v__97 produce desired quick performance.
I can use stored outlines but this is the last chance. I am playing with hints right now to produce desired plan with no result yet.
Does anybody know how to insist Oracle to merge internal views to bigger query block, so Oracle can choose better plan?
Or any guide what hints to use from ol$hints to get desired result via hints addition to original sql query (thanks God application don't cut hints just pass-through to Oracle)?
Thanks,
Sergiy -
I am trying to import data characters from a tab delimited file into a table in labview. After I import the strings, I want to be able to select individual strings from the table and put into another table. I want the item that I am selecting to appear in a text box labeled 'selected step'. After I put all of the selected data in the new table, I want to be able to save that table in another tab delimited file (spreadsheet). This is what I have so far. Any help given will be GREATLY appreciated.
Attachments:
Selector.zip 30 KBHi,
Here are modifications to your vi to do what you are describing. It helps, when trying to work through issues like these on this forum to not start a new thread with each iteration of your question. Those of us that are trying to help can follow it better if you just "Reply" to your previous thread with the new, related question. If the question is for a totally new issue then a new thread is best, but when you are working through the details of essentially the same problem it really helps us follow it if you stay in one thread, and that usually means faster answers.
We also like it if, when an answer helps, you give us a rating (the more stars the better) as it is about all we get out of it!
P.M.
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion
Attachments:
SelectorV2.zip 30 KB -
Select from bkpf too heavy.Need alternative table
Hello, what are alternative tables i can use instead of bkpf?
Hi,
~ In BKPF select is S_BLART initial???
make sure u pass value to the S_BLART.
if not s_blart is initial.
SELECT bukrs belnr gjahr budat
FROM bkpf
INTO TABLE lt_bkpf
WHERE blart IN s_blart
AND budat LE p_date.
endif.
~ DELETE ADJACENT DUPLICATES FROM lt_bkpf COMPARING bukrs belnr gjahr.
This is not required as they are primary key fields and will ALWAYS have unique combination
~ p_date and s_umskz are selection screen fields. either they have value from the screen or empty.
in that case you dont u try this:
if not s_umskz is initial and not p_date is initial.
SELECT bukrs belnr gjahr buzei bschl umskz shkzg dmbtr kunnr zfbdt zterm zbd1t zbd2t zbd3t
FROM bseg
INTO TABLE gt_bseg
FOR ALL ENTRIES IN lt_bkpf
WHERE bukrs EQ lt_bkpf-bukrs
AND belnr EQ lt_bkpf-belnr
AND gjahr EQ lt_bkpf-gjahr
AND augdt GT p_date
AND koart EQ gc_d
AND umskz IN s_umskz
AND kunnr IN s_kunnr.
elseif p_date is initial.
SELECT bukrs belnr gjahr buzei bschl umskz shkzg dmbtr kunnr zfbdt zterm zbd1t zbd2t zbd3t
FROM bseg
INTO TABLE gt_bseg
FOR ALL ENTRIES IN lt_bkpf
WHERE bukrs EQ lt_bkpf-bukrs
AND belnr EQ lt_bkpf-belnr
AND gjahr EQ lt_bkpf-gjahr
AND augdt EQ gc_zero
AND koart EQ gc_d
AND umskz IN s_umskz
AND kunnr IN s_kunnr.
endif. -
System getting hanged whilst using Insert into table select * from table
I have a peculiar problem.
I am using the below statements:
Query 1:
insert into table ppms.erin_out@ppms_dblink select * from erin_out;
Query 2:
insert into table ppms.erin_out@ppms_dblink values(23,'dffgg',12',dfdfdgg,dfdfdg);
I am in 'interfaces' schema (testing server) and executing above statements. We have testing server and development server, both are identical, i.e one is clone of the other.
ppms_dblink is created in interfaces schema. ppms_dblink points to different database server which has two schemas 'clarity' and 'ppms'. ppms_dblink is create through authentication details of clarity schema.
erin_out table is created on ppms schema on the same dababase server pointed by ppms_dblink.
Question is :
TOAD hangs while running query 1.
Query 2 is working perfectly.
As I have pl/sql script which is using query 1. I want to know why query 1 is creating problem.
If I use query 2 in my pl/sql query then it may create performance issue as i have to use cursor then.
On clarity schema, I have insert, update, select, modify rights on ppms.erin_out.
I have tried same queries from another database server.
That is I tried queries from 'interfaces' schema of development server ( clone of the testing server ). Its working perfectly.
Message was edited by:
user484158Dhanchik:
The table from which I select rows, to insert into table on dblink, is having only one record. It may contatin maximum 100 rows at a time because I am scheduling the procedure through daemon process. Anyway transaction is not more than 100 records. I am trying with just 1 record for testing.
So 1) Problem is not about the cost, TOAD is getting hanged ( to insert 1 record, cost does not mean much)
2) there is no large amount of data, so no question of deteriorated performance
Aron Tunzi:
I think that should not be problem, because I am able to insert a record through query 2.
Warren Tolentino :
I am testing with 1 record only. Its not performance issue.
Message was edited by:
रचित -
Hi,
I have to select from a large table called sales_data which has 1 cr rows.
It has an index.
I want to select all the rows. It is taking about 1 hr to select and insert into a new table.
Create table new_tab as select col1,col2,col3,col4 from sales_data;
Is there any way to reduce time.
TIAHave you tried serial/parallel direct-load INSERT method. It will be good if you can disable the constraint on the source_table before performing the DML.
You can give it a try (any of the 2 options below ) and see if it improves the performance.
INDEX on the source_table is NOT required -- DISBALE it before performing the DML.
SQL> <Your query to disable> constraints on the source_table
SQL > ALTER TABLE target_table NOLOGGING;
Option #1 For SERIAL direct load method,
INSERT /*+ APPEND */
Into target_table
Select * from source_table;
Or using PARALLEL Direct load method -
SQL > ALTER SESSION ENABLE PARALLEL DML
SQL > ALTER SESSION ENABLE PARALLEL DML;
SQL > INSERT /*+ PARALLEL(target_table,12) */ INTO target_table
SELECT /*+ PARALLEL(source_table,12) */ * FROM source_table;
Good luck.
Shailender Mehta -
Dynamic data select from table is giving dump
Hello Experts,
Below statement is giving Dump after it move all the data in my dynamic table.
When i see in debug. All my recored are avilable in <T_TAB> Table.
SELECT * FROM (pa_tab) INTO CORRESPONDING FIELDS OF TABLE <T_TAB>.
> IF SY-SUBRC = 0.
Information on where terminated
The termination occurred in the ABAP program "ZFIR_ZTABLE_UPLOAD" in
"F_DOWNLOAD".
The main program was "ZFIR_ZTABLE_UPLOAD ".
The termination occurred in line 403 of the source code of the (Include)
program "ZFIR_ZTABLE_UPLOAD"
of the source code of program "ZFIR_ZTABLE_UPLOAD" (when calling the editor
4030).
Processing was terminated because the exception "CX_SY_OPEN_SQL_DB" occurred in
the
procedure "F_DOWNLOAD" "(FORM)" but was not handled locally, not declared in
the
RAISING clause of the procedure.
The procedure is in the program "ZFIR_ZTABLE_UPLOAD ". Its source code starts
in line 399
of the (Include) program "ZFIR_ZTABLE_UPLOAD ".
please help me.
Regards,
Amit
Message was edited by:
Amit GuptaHi Amit,
Check if you are doing the following in your program
FIELD-SYMBOLS <T_TAB> TYPE STANDARD TABLE.
DATA: g_tabref type ref to data. "Reference to your table structure
CREATE DATA g_tabref type standard table of (pa_tab).
ASSIGN g_tabref->* to <T_TAB>.
SELECT * FROM (PA_TAB) INTO TABLE <T_TAB>.
Hope this solves your problem.
Let me know if you require any further info.
Enjoy SAP. Reward points of useful
Rajasekhar -
Performace Which is better ? : Bapi inside a loop OR Select from Tables
Hi Gurus,
I have a report which displays purchase info records.
If I am selecting from tables i need to use EINA, EINE, EORD and some other tables.
There is a BAPI which gets all purchase info records specific to a vendor , material , purchasing organisation.
QUESTION: Performace wise which is the better Approach, either selecting from tables or BAPI for Purchase info records
Regards
Avi.Whether it using BAPI or select. you need to check the performance. If you have full key for these tables EINA, EINE, EORD then mak a select outside of the loop and within loop use READ TABLE statement with binary search. of if you want multiple records within loop then use loop insdie loop.
Your final objective is to minimise the database hits . If you use bapi inside loop then your database hits will be more
select from EINA
select from EINE
select from EORD
loop at itab,
read table EINA
read table EINE
read table EORD
endloop
a® -
Problem in selection from data base with RANGE-TABLE.
Dear folks,
I am facing weird problem with range table in selection query.I have problem with bold part of code.Here when i give input to both ranges r_salesno,r_brandid then and the selection occurs ,when i put black in one of those it does not work.I haev passed Empty table to range if no inpiut in elements..although it does not work..I dont know why it is happening...By the i m using this code in Webdynpro ABAP.Please help points will be awarded..
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = space.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
endif.
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = space.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
endif.
*If any of these are given then select data accordingly.
<b>select * from ZNSLVWHDIMMD_LCL
into corresponding fields of table IT_VIEW
WHERE SALESRLNO in r_salesno
* and CREATEDBY in It_crtby_selopt
* and STARTDATE in It_validfrm_selopt
* and ENDDATE in It_validto_selopt
* and STATUS in It_status_selopt1
and BRANDID in r_brandid.
* and MODELNO in It_model_selopt.</b>Hello Nirad
Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
REFRESH: r_salesno. " means: select all sales numbers
" NOTE: If you fill the range like below this means that only sales order
" with no sales number (= ' ', space) should be select.
" Thus, there will never be any sales order selected.
* wa_salesno-sign = 'I'.
* wa_salesno-option = 'EQ'.
* wa_salesno-LOW = space.
* APPEND wa_salesno TO r_salesno.
* CLEAR : wa_salesno .
endif.
The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
REFRESH: r_brandid. " means: select all BRANDID
* wa_brandid-sign = 'I'.
* wa_brandid-option = 'EQ'.
* wa_brandid-LOW = space.
* APPEND wa_brandid TO r_brandid.
* CLEAR : wa_brandid .
endif.
Regards
Uwe -
Select from three tables (one field)
Dear Friends
I have start-of-selection.
select * from qals into corresponding fields of table itab where enstehdat in s_tarih.
loop at itab.
select matnr ntgew from mara into (mara-matnr, mara-ntgew) where matnr eq itab-matnr.
select matnr zfirmaadi ztezgah1 from zomt_malz into (zomt_malz-matnr, zomt_malz-zfirmaadi, zomt_malz-ztezgah1)
where matnr eq itab-matnr.
move-corresponding itab to itab2.
itab2-zfirmaadi = zomt_malz-zfirmaadi.
itab2-matnr = zomt_malz-matnr .
itab2-ztezgah1 = zomt_malz-ztezgah1.
itab2-ntgew = mara-ntgew.
if sy-subrc = 0.
append itab2.
endif.
endselect.
endselect.
endloop.
end-of-selection.
And I want to get unique matnr from this qals,zomt_malz, mara .
Your helps will be very appreciated.hi,
never use select statemnts inside loop.
use FOR ALL ENTRIES.
look this code.
select * from qals
into corresponding fields of table itab
where enstehdat in s_tarih.
select matnt ntgew
from mara
into table itab_mara
for all entries in itab
where
matnr = itab-matnr.
select matnr zfirmaadi ztezgah1
from zomt_malz into table itab_ ztezgah1
for all entries in itab
where
matnr = itab-matnr.
loop at itab.
move-corresponding itab to itab2.
read table itab_mara with key matnr = itab-matnr.
if sy-subrc = 0.
itab2-ntgew = mara-ntgew.
endif.
read table itab_ ztezgah1 with key matnr = itab-matnr.
if sy-subrc = 0.
itab2-zfirmaadi = zomt_malz-zfirmaadi.
itab2-matnr = zomt_malz-matnr .
itab2-ztezgah1 = zomt_malz-ztezgah1.
endif.
append itab2.
clear itab2.
endloop.
regrds
anver
if helped mark points -
To Transfer data from internal table to a table control
Hi All,
I have selected some data to be displayed on a screen into an internal table ...............my problem is how to transfer the data from the internal table to this table control so that when screen is displayed the data is also displayed.
Regards,
ShwetaHi Shweta,
<b>Please see if the below demo program is helpful...
DEMO_DYNPRO_TABCONT_LOOP</b>
==============================
controls flights type tableview using screen 100.
select * from spfli into corresponding fields of table itab.
call screen 100.
module status_0100 output.
set pf-status 'SCREEN_100'.
describe table itab lines fill.
flights-lines = fill.
endmodule.
module fill_table_control output.
read table itab into demo_conn index flights-current_line.
endmodule.
module cancel input.
leave program.
endmodule.
module read_table_control input.
lines = sy-loopc.
modify itab from demo_conn index flights-current_line.
endmodule.
module user_command_0100 input.
save_ok = ok_code.
clear ok_code.
case save_ok.
when 'NEXT_LINE'.
flights-top_line = flights-top_line + 1.
limit = fill - lines + 1.
if flights-top_line > limit.
flights-top_line = limit.
endif.
when 'PREV_LINE'.
flights-top_line = flights-top_line - 1.
if flights-top_line < 0.
flights-top_line = 0.
endif.
when 'NEXT_PAGE'.
flights-top_line = flights-top_line + lines.
limit = fill - lines + 1.
if flights-top_line > limit.
flights-top_line = limit.
endif.
when 'PREV_PAGE'.
flights-top_line = flights-top_line - lines.
if flights-top_line < 0.
flights-top_line = 0.
endif.
when 'LAST_PAGE'.
flights-top_line = fill - lines + 1.
when 'FIRST_PAGE'.
flights-top_line = 0.
endcase.
endmodule.
Thanks, ABY -
How to Copy data from field symbol to Dynamic Internal Table
Hi,
I want to copy the data between two dynamic Internal tables . Following is the code were I have data in the field symbol wanted to transfer it to the other Internal table :
REPORT ztest.
DATA:
gd_dref TYPE REF TO data,
gd_dref1 TYPE REF TO data.
FIELD-SYMBOLS: <fs1> TYPE any,
<fs_wa> TYPE any,
<field> TYPE any,
<fs_wa1> TYPE ANY TABLE. * Contains data from p_src
*Copy data from p_src to p_dest*
PARAMETERS: p_src LIKE dd02l-tabname . * Name of Dynamic Internal table *
p_dest LIKE dd02l-tabname . * Name of Dynamic Internal table*
*DATA : lt_csks LIKE p_dest WITH HEADER LINE.
START-OF-SELECTION.
CREATE DATA gd_dref TYPE (p_src).
CREATE DATA gd_dref1 TYPE TABLE OF (p_src).
ASSIGN gd_dref->* TO <fs_wa>.
ASSIGN gd_dref1->* TO <fs_wa1>.
SELECT * FROM (p_src) INTO TABLE <fs_wa1>.
*Write out data from FIELD SYMBOLS TO Table.
loop at <fs_wa1> into <fs_wa>.
do.
assign component sy-index
of structure <fs_wa> to <field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <field>.
else.
write: / <field>.
endif.
enddo.
endloop.
*Need Logic To Copy the Data to p_dest table from <fs_wa1>.
*p_dest is a table having a similar structure to table p_src .
*Need Logic To Copy the Data to p_dest table from <fs_wa1>.
EXIT.
Thanks in Advance.try this...
I have extended your source code and just used vbak/vbap as an example as they have some common fields like vbeln/erdat etc which corresponds with your requirement of 'similar structure' i.e. shared/common fields in both.
Cheers...
report ztest.
data:
gd_dref type ref to data,
gd_dref1 type ref to data,
gd_dref_str type ref to data,
gd_dref_tab type ref to data.
field-symbols:
<fs1> type any,
<fs_wa> type any,
<fs1_dest_str> type any,
<fs_dest_tab> type any table,
<field> type any,
<fs_wa1> type any table.
* contains data from p_src
*Copy data from p_src to p_dest*
parameters: p_src like dd02l-tabname default 'vbak',
* name of dynamic internal table *
p_dest like dd02l-tabname default 'vbap'.
* name of dynamic internal table*
*data : lt_csks like p_dest with header line.
start-of-selection.
create data gd_dref type (p_src).
create data gd_dref1 type table of (p_src).
assign gd_dref->* to <fs_wa>.
assign gd_dref1->* to <fs_wa1>.
select * from (p_src) into corresponding fields of table <fs_wa1>
up to 3 rows
where vbeln ne space.
create data gd_dref_str type (p_dest).
create data gd_dref_tab type standard table of (p_dest).
assign gd_dref_str->* to <fs1_dest_str>.
assign gd_dref_tab->* to <fs_dest_tab>.
*write out data from field symbols to table.
loop at <fs_wa1> into <fs_wa>.
" break-point here - can see vbeln/waers/create date/ etc move over to new structure
" the 'common' fields of your structures - the same will happen. if they not the same name you will have to do an
" explicit move i.e. if fieldname = xyz ....move fieldxyz to new field123....after the move-corre
break-point.
move-corresponding <fs_wa> to <fs1_dest_str>.
insert <fs1_dest_str> into table <fs_dest_tab>.
** do.
** assign component sy-index
** of structure <fs_wa> to <field>.
** if sy-subrc <> 0.
** exit.
** endif.
** if sy-index = 1.
** write:/ <field>.
** else.
** write: / <field>.
** endif.
** enddo.
endloop.
" write out some dest data from the dest table build from previous loop
loop at <fs_dest_tab> assigning <fs1_dest_str>.
do.
assign component sy-index of structure <fs_wa> to <field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <field>.
else.
write: / <field>.
endif.
enddo.
endloop. -
Select from v$sql_plan in a procedure
Hi
I''m attempting to save plans (from V$SQL_PLAN) into a table using a procedure in schema APPS, but keep getting missing table error,
PL/SQL: ORA-00942: table or view does not existI then granted an explicit SELECT to APPS on the V$SQL_PLAN table from a schema with
a DBA role, but still get the same error when compiling the procedure.
SQL> create table gl_imp_post_plans as ( select * from v$sql_plan where rownum < 1);
Table created.
SQL> select count(*) from v$sql_plan;
COUNT(*)
13506
SQL> create or replace procedure Ins_Plan_from_Dictionary as
2
3 begin
4 insert into GL_Imp_Post_Plans
5 select sqo.*
6 from v$sql_plan sqo
7 where (sqo.sql_id) not in (select distinct gipi.SQL_ID
8 from GL_Imp_Post_Plans gipi)
9 and (sqo.sql_id) in (select distinct
10 sqi.sql_id
11 from v$sql_plan sqi
12 where sqi.object_owner = 'APPS'
13 and sqi.object_name in ('GL_BALANCES','GL_DAILY_BALANCES','GL_JE_LINES') );
14 commit;
15
16
17 exception
18 when others then
19 rollback;
20 -- sysao_util.Message ('O', 'Error ' || sqlerrm);
21
22 end Ins_Plan_from_Dictionary;
23 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE INS_PLAN_FROM_DICTIONARY:
LINE/COL ERROR
4/5 PL/SQL: SQL Statement ignored
11/40 PL/SQL: ORA-00942: table or view does not exist
SQL>
SQL> l 11
11* from v$sql_plan sqiThe same error occurs when I attempt to select from GV$SQL_PLAN or DBA_HIST_SQL_PLAN.
Could anybody suggest how I can persist the rows into a table using a procedure?
thanksthanks, yes this works:
create or replace procedure Ins_Plan_from_Dictionary as
begin
execute immediate 'begin
insert into GL_Imp_Post_Plans
select sqo.*
from v$sql_plan sqo
where (sqo.sql_id) not in (select distinct gipi.SQL_ID
from GL_Imp_Post_Plans gipi)
and (sqo.sql_id) in (select distinct
sqi.sql_id
from v$sql_plan sqi
where sqi.object_owner = ''APPS''
and sqi.object_name in (''GL_BALANCES'',''GL_DAILY_BALANCES'',''GL_JE_LINES'') );
commit;
end;';
exception
when others then
rollback;
-- sysao_util.Message ('O', 'Error ' || sqlerrm);
end Ins_Plan_from_Dictionary;
/
Maybe you are looking for
-
How to fetch data in a grid format in a bean area in forms 6i?
Hi, I need help from all the gurus and experienced persons in forms 6i. I am trying to build form which will have some text fields and a bean area which will display the records that I had entered. Basically following is the basic form structure I am
-
Hi! Find attached a file which stores two variables (x, y) in a file .txt every time the button "Run" is pressed. I don't know why, but in Pocket Pc it doesn't work: the file .txt is created correctly, but this file is empty. 0,3232
-
Strange problem (Korean language in jsp page) - Urgent Please
Dear friends, I have a strange problem. in my jsp page, i have to add hangul words also using korean language. (hangul). After adding hangul language in jsp page, in browser, it is displaying in some other format. how can i display hangul script on b
-
Hi, Can you please let me know the approach to consume a REST service dynamically. I have a custom orchestration service as described in the below thread. I use BRE resolvers to resolve and set the endpoints runtime on dynamic ports. Also using dyna
-
Very slow initComponents calls?
Hi there, I've been noticing sluggishness in my application that seems more extreme than I believe it should be. When I profile the application, I get huge hot spots inside the initComponents() functions generated by NetBeans for the layout. The two