Does the union improves the performance?
Hi all,
I would like to know does the union in sql or pl/sql optimizes the performance of the query? here we are retreiveing the data from a remote databse to see about 3700 hundred records it took on oracle 9i 40 seconds to get, where as when we added the union its retriving the data in 2 seconds does the union has anything to do with backend in pl/sql to optimize this query.
CURSOR ecur IS
SELECT 0 id,' No PO' name,'' dir,'' SYMBOL,'' PHONE,'' EMAIL FROM dual
UNION
SELECT id,name,DIR,SYMBOL,PHONE,EMAIL
FROM [email protected]
WHERE dir IN ('A','C','W','V','S','SA','H')
AND name LIKE initcap(match)||'%'
ORDER BY name;
before added the union select statement it took 40 seconds after i added the union its taking 2 seconds.. so i want to know the difference between these two statements why so much difference in performance.
please do help me out...
Thanks a lot.....
Do an explain plan of the two queries. Chances are the optimizer decided to use a different plan for the main query when you unioned it with dual.
Similar Messages
-
Does increasing ram improves game performance?
does increasing ram improves game performance of my MBP 13" 2012??
Using Activity Monitor to read System Memory & determine how much RAM is used
Adding RAM only makes it possible to run more programs concurrently. It doesn't speed up the computer nor make games run faster. What it can do is prevent the system from having to use disk-based VM when it runs out of RAM because you are trying to run too many applications concurrently or using applications that are extremely RAM dependent. It will improve the performance of applications that run mostly in RAM or when loading programs. -
One of my friends working on mssql told me that recreating of procedures could improve the database performance. If you have created the procedure and recreated it after insertion of huge volume of data.
Is it true. If so how?I think so too but he said that in his microsoft certified course told that it could improve the performance.
He told me that the select statements prevously used uses the old statistic but after recreating it uses the new statistic. -
C3-01 - Does Latest Software Improve WiFi Performa...
Hi all
According to the Nokia website, the current software for the C3-01 touch & type is v.7.51, but the most up to date version that I am able to install via Nokia Suite is v.7.15. I suspect this is because my phone is on the Orange/EE network in UK and they have stopped supporting updates for this handset.
I am struggling with a problem connecting to public WiFi networks and I am wondering if the latest v.7.51 software has any improvements to WiFi performance. Does anyone know if this is the case?
I appreciate this phone is a couple of years old but it is still working perfectly for my needs, except for the WiFi problem.
TIAThis update had general performance and stability improvements.
If i have helped at all a click on the white star below would be nice thanks.
Now using the Lumia 1520 -
Does native compiling improve application performance ?
Hi,
I've got familiar with Excelsior Native Compiler since a week ago. They claim on their website that compiling Java classes directly to native code (machine code) will improve the performance of the application. However, JAlbum (http://jalbum.net) says that its JAR files of the application run "basically at the same speed" compared to the native compiled one for windows.
Does really compiling Java classes to native code improve performance? I'm not talking about the startup speed, but the whole application performance.
Thanks...Youve really been spreading that article aroundthis
morning, George, lol.
It was actually a really good read this morning.
Thanks for posting it.I know! just realized that's about the 3rd or 4th
time I've posted it today. just a coincidence, thoughcan't promote that book enough though. Should be required reading (just like Effective Java). -
How to hide one of the unions from the results?
Hi all,
I have a graph which contains 5 unions. The top query is used to pass the functions and the other 4 are the ones that really doing the caclutaions. Is there any way to hid one query from results?
Thanks in advance.Hiding based on what? If it is a prompt, assign a presentation variable and add a condition to the filter of your desirable result-set in a structure like:
CASE WHEN '@{myPresentationVariable}{DefaultValue}' = 'WhateverValueIWant' THEN 1 ELSE 0 END = 1 -
Better to write this query -- the UNION kills the query
Is there a better way to write this qery to avoid the union?
CREATE TABLE EMP
EMP_ID NUMBER,
LAST_NAME VARCHAR2(20),
FIRST_NAME VARCHAR2(20),
MID_NAME VARCHAR2(20)
CREATE TABLE EMP_NM
EMP_ID NUMBER,
LAST_NAME VARCHAR2(20),
FIRST_NAME VARCHAR2(20),
MID_NAME VARCHAR2(20)
INSERT INTO EMP
VALUES(
1, 'ANDERSON', 'SCOTT', NULL)
INSERT INTO EMP
VALUES
(2, 'KEVINSKY', 'KEVIN', NULL
INSERT INTO EMP_NM
VALUES(
1, 'ANDERSON', 'SCOTT', NULL)
INSERT INTO EMP_NM
VALUES(
1, 'LEE', 'SCOTT', 'K')
INSERT INTO EMP_NM
VALUES
(2, 'KEVINSKY', 'KEVIN', NULL )
INSERT INTO EMP_NM
VALUES
(2, 'ANDERSON', 'KEVIN', NULL )
SELECT
E.EMP_ID ,
E.LAST_NAME ,
E.FIRST_NAME ,
E.MID_NAME FROM
EMP E
WHERE
E.LAST_NAME =:LAST_NAME
UNION
SELECT
E.EMP_ID ,
E.LAST_NAME ,
E.FIRST_NAME ,
E.MID_NAME
FROM
SELECT EN.EMP_ID
FROM
EMP_NM EN
WHERE
EN.LAST_NAME =:LAST_NAME ) EN1 ,
EMP E
WHERE
E.EMP_ID = EN1.EMP_IDEXPLAIN PLAN without sort
SELECT STATEMENT Optimizer Mode=CHOOSE 171 K 6717
FILTER
TABLE ACCESS FULL EMP 171 K 5 M 6717
TABLE ACCESS BY INDEX ROWID EMP_NM 1 14 1
INDEX RANGE SCAN IDXEMP_ID 1 3
EXPLIAN PLAN WITH SORT
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 171 K 7658
SORT ORDER BY 171 K 5 M 7658
FILTER
TABLE ACCESS FULL EMP 171 K 5 M 6717
TABLE ACCESS BY INDEX ROWID EMP_NM 1 14 1
INDEX RANGE SCAN IDXEMP_ID 1 3 -
Improve the Performance of Loops
Has anyone read "Improve the Performance of Loops" on http://archive.devx.com/free/tips/tipview.asp?content_id=3945 ?
If so, would you agree that what's written there is absolute b.....t?
He claims that decreasing the counter improves the performance and tries to prove it with the program:
for (int i=0,n=Integer.MAX_VALUE;i<n;i++){
a =-a;
// is slower than
long midTime =System.currentTimeMillis();
for (int i=Integer.MAX_VALUE-1 ; i>=0 ; i--){
a =-a;
}The result is pretty impressive:
Increasing Loop:4891
Decreasing Loop:3781
The only stupid thing is that:
1. if you run it more times you get
Increasing Loop:4891
Decreasing Loop:3781
Increasing Loop:3782
Decreasing Loop:3796
Increasing Loop:3891
Decreasing Loop:3891
Increasing Loop:3828
Decreasing Loop:3937
Increasing Loop:3891
Decreasing Loop:3906
Increasing Loop:3860
Decreasing Loop:3937
Increasing Loop:3891
Decreasing Loop:3906
So you can see that the performance is worse for decreasing loops after hotspot warmed up.
2. If you run it with -server, you'll even get:
Increasing Loop:16
Decreasing Loop:0
Increasing Loop:0
Decreasing Loop:0
Increasing Loop:0
Decreasing Loop:0
Increasing Loop:0
Decreasing Loop:0
Increasing Loop:0
Decreasing Loop:0
Increasing Loop:0
Decreasing Loop:0
Increasing Loop:0
Decreasing Loop:0
This shows that hotspot sever is much more clever than some programmers.
Even if you change the code to do something bit better like
public TimeLoop() {
int a = 2,b=2;
long startTime = System.currentTimeMillis();
for (int i = 0, n = Integer.MAX_VALUE; i < n; i++) {
a ^= i;
long midTime = System.currentTimeMillis();
for (int i = Integer.MAX_VALUE - 1; i >= 0; i--) {
a ^= i;
long endTime = System.currentTimeMillis();
System.out.println("Increasing Loop:" + (midTime - startTime));
System.out.println("Decreasing Loop:" + (endTime - midTime));
System.out.println("a="+a+" b="+b); // Hotspot must perform _some_ kind of calculation to print this
}You'll find that it doesn't really matter whether you're xoring in increasing or decreasing order.
For -client:
Increasing Loop:296
Decreasing Loop:297
a=2 b=2
Increasing Loop:297
Decreasing Loop:281
a=2 b=2
Increasing Loop:297
Decreasing Loop:297
a=2 b=2
For -server:
Increasing Loop:141
Decreasing Loop:156
a=2 b=2
Increasing Loop:141
Decreasing Loop:141
a=2 b=2
Increasing Loop:140
Decreasing Loop:156
a=2 b=2
(Last three runs for each).
And I don't believe that accessing array.length is slower than storing the length in an int and comparing against that int!
Please let's just stop posting silly perfomance tuning tips!Well, you can always look at the bytecode produced. I wrote two little classes:public class t {
public static void main ( String[] args ) {
int a = 0;
for (int i=0,n=Integer.MAX_VALUE;i<n;i++){ a =-a; }
}andpublic class t1 {
public static void main ( String[] args ) {
int a = 0;
for (int i=Integer.MAX_VALUE-1 ; i>=0 ; i--){ a =-a; }
}And here's the bytecode for their main() methods. (Extra/different bytecodes in "t" are marked):t: (incrementing)Method void main(java.lang.String[])
0 iconst_0
1 istore_1
==>2 iconst_0
3 istore_2
4 ldc #2 <Integer 2147483647>
6 istore_3
7 goto 16
10 iload_1
11 ineg
12 istore_1
13 iinc 2 1
16 iload_2
==>17 iload_3
==>18 if_icmplt 10
21 return
t1: (decrementing)
Method void main(java.lang.String[])
0 iconst_0
1 istore_1
2 ldc #2 <Integer 2147483646>
4 istore_2
5 goto 14
8 iload_1
9 ineg
10 istore_1
11 iinc 2 -1
14 iload_2
15 ifge 8
18 return The decrementing code does use fewer bytecodes to do its thing.
However, as someone pointed out - once Hotspot gets involved, all bets are off. And as someone else pointed out, if the body of the loop does nearly anything at all, the 2-bytecode-difference is going to get completely swamped.
In general, this is the kind of micro-optimizing that I'd ignore completely...
Grant -
Alias tabls does really improves the performence
hi all gurus
since long time i have one question in my mind about alias table
if we use alias table in physical layer,does it really improves the performance ??
so for i have used it for to avoid self joins,
can u give me at least one scenario regarding alias table?
Apart form that all are telling that one table is use full for more than one time that time we have to go for alias table
is it true?
let us take small example as sh schema ,in that we have two facts,cost and sales and dimension like product,countries,time
here my question is to maintain start schema in physical layer we have to go for alias concept.
if we give direct joins to the fact with dimensions,will it decrease the performance ?
i don't under stand ,can any one clear about it?
Thanks a lot in advanceThe Answers is No for the example you described about SH Schema.
Aliasing tables, IMHO, doesn't contribute to performance gain/lag.
Aliasing concept is used to implement some complicated scenarios, like the one you described i.e. self joins.
Other examples would be a 1. circular join, 2. prevent clutter in physical layer, 3. set specific cache properties etc....are few i remember on top of my head.
In a nutshell, think of it as a modelling technique to implement complexities.
mark answers promptly.
-bifacts
http://www.obinotes.com
J -
Whats wrong with the UNION ALL
Hi All
I have the following table and data
WITH sample_data AS
(SELECT '1' AS bin_data_id, '539' AS traffic_sample_id,
'1100' AS end_intv_time, '0' AS bin_1_data, '34' AS bin_2_data,
'19' AS bin_3_data
FROM DUAL
UNION ALL
SELECT '2', '539', '1200', '0', '65', '18'
FROM DUAL
UNION ALL
SELECT '3', '539', '1300', '0', '51', '17'
FROM DUAL
UNION ALL
SELECT '4', '539', '1400', '0', '65', '27'
FROM DUAL
UNION ALL
SELECT '5', '539', '1500', '0', '99', '48'
FROM DUAL
UNION ALL
SELECT '6', '539', '1600', '0', '426', '138'
FROM DUAL
UNION ALL
SELECT '7', '539', '1700', '0', '151', '62'
FROM DUAL
UNION ALL
SELECT '8', '539', '1800', '0', '80', '32'
FROM DUAL
UNION ALL
SELECT '9', '539', '1900', '0', '31', '11'
FROM DUAL
UNION ALL
SELECT '10', '539', '2000', '0', '37', '11'
FROM DUAL
UNION ALL
SELECT '11', '539', '2100', '0', '24', '9'
FROM DUAL
UNION ALL
SELECT '12', '539', '2200', '0', '16', '5'
FROM DUAL
UNION ALL
SELECT '13', '539', '2300', '0', '27', '12'
FROM DUAL
UNION ALL
SELECT '14', '539', '2400', '0', '55', '20'
FROM DUAL
UNION ALL
SELECT '15', '539', '0100', '0', '18', '9'
FROM DUAL
UNION ALL
SELECT '16', '539', '0200', '0', '134', '52'
FROM DUAL
UNION ALL
SELECT '17', '539', '0300', '0', '230', '69'
FROM DUAL
UNION ALL
SELECT '18', '539', '0400', '0', '15', '7'
FROM DUAL
UNION ALL
SELECT '19', '539', '0500', '0', '6', '5'
FROM DUAL
UNION ALL
SELECT '20', '539', '0600', '0', '47', '23'
FROM DUAL
UNION ALL
SELECT '21', '539', '0700', '0', '100', '41'
FROM DUAL
UNION ALL
SELECT '22', '539', '0800', '0', '196', '43'
FROM DUAL
UNION ALL
SELECT '23', '539', '0900', '0', '81', '20'
FROM DUAL
UNION ALL
SELECT '24', '539', '1000', '0', '58', '28'
FROM DUAL
UNION ALL
SELECT '25', '539', '1100', '0', '58', '24'
FROM DUAL
UNION ALL
SELECT '26', '539', '1200', '0', '60', '22'
FROM DUAL
UNION ALL
SELECT '27', '539', '1300', '0', '42', '18'
FROM DUAL
UNION ALL
SELECT '28', '539', '1400', '0', '53', '15'
FROM DUAL
UNION ALL
SELECT '29', '539', '1500', '0', '107', '43'
FROM DUAL
UNION ALL
SELECT '30', '539', '1600', '0', '441', '146'
FROM DUAL
UNION ALL
SELECT '31', '539', '1700', '0', '128', '34'
FROM DUAL
UNION ALL
SELECT '32', '539', '1800', '0', '67', '27'
FROM DUAL
UNION ALL
SELECT '33', '539', '1900', '0', '45', '22'
FROM DUAL
UNION ALL
SELECT '34', '539', '2000', '0', '24', '13'
FROM DUAL
UNION ALL
SELECT '35', '539', '2100', '0', '16', '11'
FROM DUAL
UNION ALL
SELECT '36', '539', '2200', '0', '28', '5'
FROM DUAL
UNION ALL
SELECT '37', '539', '2300', '0', '23', '8'
FROM DUAL
UNION ALL
SELECT '38', '539', '2400', '0', '73', '11'
FROM DUAL
UNION ALL
SELECT '39', '539', '0100', '0', '16', '3'
FROM DUAL
UNION ALL
SELECT '40', '539', '0200', '0', '243', '82'
FROM DUAL
UNION ALL
SELECT '41', '539', '0300', '0', '121', '55'
FROM DUAL
UNION ALL
SELECT '42', '539', '0400', '0', '17', '4'
FROM DUAL
UNION ALL
SELECT '43', '539', '0500', '0', '5', '5'
FROM DUAL
UNION ALL
SELECT '44', '539', '0600', '0', '41', '15'
FROM DUAL
UNION ALL
SELECT '45', '539', '0700', '0', '101', '34'
FROM DUAL
UNION ALL
SELECT '46', '539', '0800', '0', '184', '43'
FROM DUAL
UNION ALL
SELECT '47', '539', '0900', '0', '69', '15'
FROM DUAL
UNION ALL
SELECT '48', '539', '1000', '0', '51', '18'
FROM DUAL
UNION ALL
SELECT '49', '539', '1100', '0', '61', '25'
FROM DUAL)
SELECT *
FROM sample_data;Now i have 2 queries , the one below query is to just get the last bin_data_id per each traffic_sample_id
SELECT ROW_NUMBER () OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id)
AS rn_1,
COUNT (bin_data_id) OVER (PARTITION BY traffic_sample_id) AS cnt_1,TRAFFIC_SAMPLE_ID,bin_data_id,(END_INTV_TIME_1+100) AS END_INTV_TIME,BIN_1_DATA,BIN_2_DATA,BIN_3_DATA
FROM
SELECT ROW_NUMBER() OVER(ORDER BY TRAFFIC_SAMPLE_ID) AS RN,traffic_sample_id,
end_intv_time,
last_value(end_intv_time) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS END_INTV_TIME_1,
LAST_VALUE (bin_data_id) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_data_id,
LAST_VALUE (bin_1_data) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_1_data,
LAST_VALUE (bin_2_data) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_2_data,
LAST_VALUE (bin_3_data) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_3_data
FROM bin_data
WHERE RN=BIN_DATA_ID
and traffic_sample_id=539And now i'm doing the UNION ALL the above query with a different query as below
select rn_1,cnt_1,traffic_sample_id, bin_data_id, to_number(end_intv_time),bin_1_data,bin_2_data,bin_3_data
from
select ROW_NUMBER () OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id)
AS rn_1,
COUNT (bin_data_id) OVER (PARTITION BY traffic_sample_id) AS cnt_1,
traffic_sample_id, bin_data_id, end_intv_time, direction,bin_1_data,bin_2_data,bin_3_data
from
SELECT ROW_NUMBER () OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id)
AS rn,
COUNT (bin_data_id) OVER (PARTITION BY traffic_sample_id) AS cnt,
traffic_sample_id, bin_data_id, end_intv_time, direction,bin_1_data,bin_2_data,bin_3_data
FROM bin_data
where rn!=1
where traffic_sample_id=539
union all
SELECT ROW_NUMBER () OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id)
AS rn_1,
COUNT (bin_data_id) OVER (PARTITION BY traffic_sample_id) AS cnt_1,TRAFFIC_SAMPLE_ID,bin_data_id,(END_INTV_TIME_1+100) AS END_INTV_TIME,BIN_1_DATA,BIN_2_DATA,BIN_3_DATA
FROM
SELECT ROW_NUMBER() OVER(ORDER BY TRAFFIC_SAMPLE_ID) AS RN,traffic_sample_id,
end_intv_time,
last_value(end_intv_time) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS END_INTV_TIME_1,
LAST_VALUE (bin_data_id) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_data_id,
LAST_VALUE (bin_1_data) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_1_data,
LAST_VALUE (bin_2_data) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_2_data,
LAST_VALUE (bin_3_data) OVER (PARTITION BY traffic_sample_id ORDER BY bin_data_id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS bin_3_data
FROM bin_data
WHERE RN=BIN_DATA_ID
and traffic_sample_id=539Now all works fine and appends the single record to the set of records and i get the following data set.
RN_1 CNT_1 TRAFFIC_SAMPLE_ID BIN_DATA_ID TO_NUMBER(END_INTV_TIME) BIN_1_DATA BIN_2_DATA BIN_3_DATA
1 48 539 2 1200 0 65 18
2 48 539 3 1300 0 51 17
3 48 539 4 1400 0 65 27
4 48 539 5 1500 0 99 48
5 48 539 6 1600 0 426 138
6 48 539 7 1700 0 151 62
7 48 539 8 1800 0 80 32
8 48 539 9 1900 0 31 11
9 48 539 10 2000 0 37 11
10 48 539 11 2100 0 24 9
11 48 539 12 2200 0 16 5
12 48 539 13 2300 0 27 12
13 48 539 14 2400 0 55 20
14 48 539 15 100 0 18 9
15 48 539 16 200 0 134 52
16 48 539 17 300 0 230 69
17 48 539 18 400 0 15 7
18 48 539 19 500 0 6 5
19 48 539 20 600 0 47 23
20 48 539 21 700 0 100 41
21 48 539 22 800 0 196 43
22 48 539 23 900 0 81 20
23 48 539 24 1000 0 58 28
24 48 539 25 1100 0 58 24
25 48 539 26 1200 0 60 22
26 48 539 27 1300 0 42 18
27 48 539 28 1400 0 53 15
28 48 539 29 1500 0 107 43
29 48 539 30 1600 0 441 146
30 48 539 31 1700 0 128 34
31 48 539 32 1800 0 67 27
32 48 539 33 1900 0 45 22
33 48 539 34 2000 0 24 13
34 48 539 35 2100 0 16 11
35 48 539 36 2200 0 28 5
36 48 539 37 2300 0 23 8
37 48 539 38 2400 0 73 11
38 48 539 39 100 0 16 3
39 48 539 40 200 0 243 82
40 48 539 41 300 0 121 55
41 48 539 42 400 0 17 4
42 48 539 43 500 0 5 5
43 48 539 44 600 0 41 15
44 48 539 45 700 0 101 34
45 48 539 46 800 0 184 43
46 48 539 47 900 0 69 15
47 48 539 48 1000 0 51 18
48 48 539 49 1100 0 61 25
1 1 539 49 1200 0 61 25But please help me , all the above queries are working fine when i check by traffic_sample_id, for example if i remove the WHERE CLAUSE, WHERE TRAFFIC_SAMPLE_ID=539 from both the queries in the UNION ALL to get all the TRAFFIC_SAMPLE_ID's the single records are not getting appended to the resultant data set. Please need help.
ThanksPlease consider the following sample data
WITH sample_data AS
(SELECT '1' AS bin_data_id, '539' AS traffic_sample_id,
'1100' AS end_intv_time, '0' AS bin_1_data, '34' AS bin_2_data,
'19' AS bin_3_data
FROM DUAL
UNION ALL
SELECT '2', '539', '1200', '0', '65', '18'
FROM DUAL
UNION ALL
SELECT '3', '539', '1300', '0', '51', '17'
FROM DUAL
UNION ALL
SELECT '4', '539', '1400', '0', '65', '27'
FROM DUAL
UNION ALL
SELECT '5', '539', '1500', '0', '99', '48'
FROM DUAL
UNION ALL
SELECT '6', '539', '1600', '0', '426', '138'
FROM DUAL
UNION ALL
SELECT '7', '539', '1700', '0', '151', '62'
FROM DUAL
UNION ALL
SELECT '8', '539', '1800', '0', '80', '32'
FROM DUAL
UNION ALL
SELECT '9', '539', '1900', '0', '31', '11'
FROM DUAL
UNION ALL
SELECT '10', '539', '2000', '0', '37', '11'
FROM DUAL
UNION ALL
SELECT '11', '539', '2100', '0', '24', '9'
FROM DUAL
UNION ALL
SELECT '12', '539', '2200', '0', '16', '5'
FROM DUAL
UNION ALL
SELECT '13', '539', '2300', '0', '27', '12'
FROM DUAL
UNION ALL
SELECT '14', '539', '2400', '0', '55', '20'
FROM DUAL
UNION ALL
SELECT '15', '539', '0100', '0', '18', '9'
FROM DUAL
UNION ALL
SELECT '16', '539', '0200', '0', '134', '52'
FROM DUAL
UNION ALL
SELECT '17', '539', '0300', '0', '230', '69'
FROM DUAL
UNION ALL
SELECT '18', '539', '0400', '0', '15', '7'
FROM DUAL
UNION ALL
SELECT '19', '539', '0500', '0', '6', '5'
FROM DUAL
UNION ALL
SELECT '20', '539', '0600', '0', '47', '23'
FROM DUAL
UNION ALL
SELECT '21', '539', '0700', '0', '100', '41'
FROM DUAL
UNION ALL
SELECT '22', '539', '0800', '0', '196', '43'
FROM DUAL
UNION ALL
SELECT '23', '539', '0900', '0', '81', '20'
FROM DUAL
UNION ALL
SELECT '24', '539', '1000', '0', '58', '28'
FROM DUAL
UNION ALL
SELECT '25', '539', '1100', '0', '58', '24'
FROM DUAL
UNION ALL
SELECT '26', '539', '1200', '0', '60', '22'
FROM DUAL
UNION ALL
SELECT '27', '539', '1300', '0', '42', '18'
FROM DUAL
UNION ALL
SELECT '28', '539', '1400', '0', '53', '15'
FROM DUAL
UNION ALL
SELECT '29', '539', '1500', '0', '107', '43'
FROM DUAL
UNION ALL
SELECT '30', '539', '1600', '0', '441', '146'
FROM DUAL
UNION ALL
SELECT '31', '539', '1700', '0', '128', '34'
FROM DUAL
UNION ALL
SELECT '32', '539', '1800', '0', '67', '27'
FROM DUAL
UNION ALL
SELECT '33', '539', '1900', '0', '45', '22'
FROM DUAL
UNION ALL
SELECT '34', '539', '2000', '0', '24', '13'
FROM DUAL
UNION ALL
SELECT '35', '539', '2100', '0', '16', '11'
FROM DUAL
UNION ALL
SELECT '36', '539', '2200', '0', '28', '5'
FROM DUAL
UNION ALL
SELECT '37', '539', '2300', '0', '23', '8'
FROM DUAL
UNION ALL
SELECT '38', '539', '2400', '0', '73', '11'
FROM DUAL
UNION ALL
SELECT '39', '539', '0100', '0', '16', '3'
FROM DUAL
UNION ALL
SELECT '40', '539', '0200', '0', '243', '82'
FROM DUAL
UNION ALL
SELECT '41', '539', '0300', '0', '121', '55'
FROM DUAL
UNION ALL
SELECT '42', '539', '0400', '0', '17', '4'
FROM DUAL
UNION ALL
SELECT '43', '539', '0500', '0', '5', '5'
FROM DUAL
UNION ALL
SELECT '44', '539', '0600', '0', '41', '15'
FROM DUAL
UNION ALL
SELECT '45', '539', '0700', '0', '101', '34'
FROM DUAL
UNION ALL
SELECT '46', '539', '0800', '0', '184', '43'
FROM DUAL
UNION ALL
SELECT '47', '539', '0900', '0', '69', '15'
FROM DUAL
UNION ALL
SELECT '48', '539', '1000', '0', '51', '18'
FROM DUAL
UNION ALL
SELECT '49', '539', '1100', '0', '61', '25'
FROM DUAL
UNION ALL
SELECT '11033', '613','1300','3','421','124'
FROM DUAL
UNION ALL
SELECT '11034', '613', '1400', '4', '419', '128'
FROM DUAL
UNION ALL
SELECT '11035', '613', '1500', '5', '522', '169'
FROM DUAL
UNION ALL
SELECT '11036', '613', '1600', '5', '596', '185'
FROM DUAL
UNION ALL
SELECT '11037', '613', '1700', '9', '667', '150'
FROM DUAL
UNION ALL
SELECT '11038', '613', '1800', '4', '522', '105'
FROM DUAL
UNION ALL
SELECT '11039', '613', '1900', '2', '428', '80'
FROM DUAL
UNION ALL
SELECT '11040', '613', '2000', '5', '304', '73'
FROM DUAL
UNION ALL
SELECT '11041', '613', '2100', '1', '284', '61'
FROM DUAL
UNION ALL
SELECT '11042', '613', '2200', '3', '245', '45'
FROM DUAL
UNION ALL
SELECT '11043', '613', '2300', '6', '193', '39'
FROM DUAL
UNION ALL
SELECT '11044', '613', '2400', '0', '109', '23'
FROM DUAL
UNION ALL
SELECT '11045', '613', '0100', '0', '81', '25'
FROM DUAL
UNION ALL
SELECT '11046', '613', '0200', '0', '56', '24'
FROM DUAL
UNION ALL
SELECT '11047', '613', '0300', '0', '62', '11'
FROM DUAL
UNION ALL
SELECT '11048', '613', '0400', '0', '59', '27'
FROM DUAL
UNION ALL
SELECT '11049', '613', '0500', '1', '180', '87'
FROM DUAL
UNION ALL
SELECT '11050', '613', '0600', '4', '410', '126'
FROM DUAL
UNION ALL
SELECT '11051', '613', '0700', '6', '454', '138'
FROM DUAL
UNION ALL
SELECT '11052', '613', '0800', '4', '393', '145'
FROM DUAL
UNION ALL
SELECT '11053', '613', '0800', '4', '357', '131'
FROM DUAL
UNION ALL
SELECT '11054', '613', '0900', '5', '347', '126'
FROM DUAL
UNION ALL
SELECT '11055', '613', '1000', '3', '368', '155'
FROM DUAL
UNION ALL
SELECT '11056', '613', '1100', '2', '384', '153'
FROM DUAL
UNION ALL
SELECT '11057', '613', '1200', '7', '423', '166'
FROM DUAL
UNION ALL
SELECT '11058', '613', '1300', '9', '489', '213'
FROM DUAL
UNION ALL
SELECT '11059', '613', '1400', '5', '576', '190'
FROM DUAL
UNION ALL
SELECT '11060', '613', '1500', '11', '712', '189'
FROM DUAL
UNION ALL
SELECT '11061', '613', '1600', '9', '634', '211'
FROM DUAL
UNION ALL
SELECT '11062', '613', '1700', '3', '501', '114'
FROM DUAL
UNION ALL
SELECT '11063', '613', '1800', '2', '411', '117'
FROM DUAL
UNION ALL
SELECT '11064', '613', '1900', '5', '291', '99'
FROM DUAL
UNION ALL
SELECT '11065', '613', '2000', '1', '276', '71'
FROM DUAL
UNION ALL
SELECT '11066', '613', '2100', '2', '214', '56'
FROM DUAL
UNION ALL
SELECT '11067', '613', '2200', '3', '166', '46'
FROM DUAL
UNION ALL
SELECT '11068', '613', '2300', '0', '99', '26'
FROM DUAL
UNION ALL
SELECT '11069', '613', '2400', '0', '65', '19'
FROM DUAL
UNION ALL
SELECT '11070', '613', '0100', '1', '57', '14'
FROM DUAL
UNION ALL
SELECT '11071', '613', '0200', '0', '55', '15'
FROM DUAL
UNION ALL
SELECT '11072', '613', '0300', '0', '49', '22'
FROM DUAL
UNION ALL
SELECT '11073', '613', '0400', '3', '151', '113'
FROM DUAL
UNION ALL
SELECT '11074', '613', '0500', '2', '324', '145'
FROM DUAL
UNION ALL
SELECT '11075', '613', '0600', '5', '342', '161'
FROM DUAL
UNION ALL
SELECT '11076', '613', '0700', '3', '294', '186'
FROM DUAL
UNION ALL
SELECT '11077', '613', '0800', '6', '303', '171'
FROM DUAL
UNION ALL
SELECT '11078', '613', '0900', '4', '278', '158'
FROM DUAL
UNION ALL
SELECT '11079', '613', '1000', '2', '309', '156'
FROM DUAL
UNION ALL
SELECT '11080', '613', '1100', '0', '51', '18'
FROM DUAL
UNION ALL
SELECT '11081', '613', '1200', '0', '61', '25'
FROM DUAL)
SELECT *
FROM sample_data;Here when i say the LAST(BIN_DATA_ID) i meant the last BIN_DATA_ID PER EACH TRAFFIC SAMPLE ID. What i was trying to do is in the bottom query i'm getting the LAST BIN_DATA_ID for each TRAFFIC SAMPLE ID and appending it to the top query.
Thanks -
hi.
i m trying te use the union with the query which has blob column.The query works fine with out union but with union it gave me error inconsistant data type.> but there must be a alternative solution. ???????
The success (or lack thereof) of any solution depends entirely on the Problem Statement.
What you have shown us is your solution (to an unknown problem) that attempts a MINUS operation on a BLOB. A flawed solution as you've discovered.
What you have not given us is the Problem that you are trying to solve.
If you would like us to provide "alternatives", then you need to state The Problem. -
Why a table full scan when I've got the PK in the WHERE clause?
There is a very complex query that I need to optimize in an Oracle 10gR2 environment. I am deconstructing it into layers to see what is causing the first bottleneck. The innermost portion is fine, with an explain plan cost of 54. With a typical value for the bind variable, it returns 125 zero_id values. There are over 100,000 rows in table T_ONE in my test database, but my customer has over one million rows in their production instance.
WITH t_merged_id AS (SELECT DISTINCT zero_id FROM t_zero WHERE NVL(column2, zero_id) = :i_id)
SELECT t_one.one_id
FROM t_one
INNER JOIN t_two
ON t_one.column1 = t_two.two_id
INNER JOIN t_merged_id
ON t_two.column10 = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one
INNER JOIN t_two
ON t_one.column2 = t_two.two_id
INNER JOIN t_merged_id
ON t_two.column10 = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one
INNER JOIN t_three
ON t_one.column3 = t_three.three_id
INNER JOIN t_merged_id
ON t_three.column10 = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one
INNER JOIN t_four
ON t_one.column4 = t_four.four_id
INNER JOIN t_two
ON t_four.column1 = t_two.two_id
INNER JOIN t_merged_id
ON t_two.two_id = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one INNER JOIN t_merged_id ON t_one.column5 = t_merged_id.zero_id
UNION
SELECT t_one.one_id
FROM t_one INNER JOIN t_merged_id ON t_one.column6 = t_merged_id.zero_idHowever, the next step is to obtain a bunch of columns from T_ONE for each of those ONE_ID values. Adding that looks like the following, which causes a table full scan on T_ONE (and an explain plan cost over 1,500 for this query in my test system) and it takes far too long to return the results.
SELECT t_one.*
FROM t_one
INNER JOIN
(--This is the start of the query shown above
WITH t_merged_id AS (SELECT DISTINCT zero_id FROM t_zero WHERE NVL(column2, zero_id) = :i_id)
SELECT t_one.one_id
FROM t_one
INNER JOIN t_two
ON t_one.column1 = t_two.two_id
INNER JOIN t_merged_id
ON t_two.column10 = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one
INNER JOIN t_two
ON t_one.column2 = t_two.two_id
INNER JOIN t_merged_id
ON t_two.column10 = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one
INNER JOIN t_three
ON t_one.column3 = t_three.three_id
INNER JOIN t_merged_id
ON t_three.column10 = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one
INNER JOIN t_four
ON t_one.column4 = t_four.four_id
INNER JOIN t_two
ON t_four.column1 = t_two.two_id
INNER JOIN t_merged_id
ON t_two.two_id = t_merged_id.zero_id
UNION ALL
SELECT t_one.one_id
FROM t_one INNER JOIN t_merged_id ON t_one.column5 = t_merged_id.zero_id
UNION
SELECT t_one.one_id
FROM t_one INNER JOIN t_merged_id ON t_one.column6 = t_merged_id.zero_id
--This is the end of the query shown above
) t_list
ON t_one.one_id = t_list.one_idMy question is, why wouldn’t Oracle use the existing index PK_T_ONE, which is keyed on T_ONE.ONE_ID? I tried refactoring the query using a “WHERE t_one.one_id IN” construct instead of the INNER JOIN but it didn’t make any difference. Neither did adding an index hint, which I hoped would force the use of the PK index.
Any ideas?I was able to completely resolve my problem, but I still want to understand why the original query wouldn't use an index.
(My solution was to move all the joins and where clauses from the query that wrapped the one we've been discussing and put them into each SELECT in the UNION, so there is no longer any inner subquery. So instead of trying to first get a list of ID values from the subquery, get the full records for the IDs from an outer query, and then joining to the outer query, I made SELECT in the UNION contain the full logic. This makes the query a lot more verbose, because all the joins and wheres are repeated six times, but it does use the index and returns in 0.04 seconds instead of over nine minutes in my test database.)
hoek wrote:
Values for optimizer_index_caching and optimizer_index_cost_adj are not the defaults. Any reasons for that?I am not a DBA and have no idea. However, I did a Google search and found this: http://decipherinfosys.wordpress.com/2007/02/13/optimizer_index_cost_adj-and-optimizer_index_caching/. Apparently Tom Kyte would approve more of our settings than the defaults.
hoek wrote:
Any chance to get a realistic dataset on your test server?Unfortunately, not for quite some time. The customer won't provide any real data, and generating data for testing is complex because of all the interrelationships. I have someone working on that. However, I was able to get back on the primary test server that has 136k records in the main table instead of only 2k. So far as I know, the Oracle configuration between the test server and the customer's server is the same. However, they have much more serious hardware that I do (more processors, more RAM, more platters). On the other hand, they have 10 times as much data.
hoek wrote:
Your second execution plan contains differents stats, they're not the 'common ones'. (E-rows etc.)The predicates are the same as the first. The 2nd plan was generated by the 10g-specific portion of Randolph's script using the command "select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));".
This is the result from running the script on the main test server:
NAME TYPE VALUE
_optimizer_cost_based_transformation string OFF
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.2.0.4
optimizer_index_caching integer 95
optimizer_index_cost_adj integer 10
optimizer_mode string CHOOSE
optimizer_secure_view_merging boolean TRUE
db_file_multiblock_read_count integer 32
db_block_size integer 8192
cursor_sharing string FORCE
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 04-04-2008 07:02
SYSSTATS_INFO DSTOP 04-04-2008 07:02
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 646.57331
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
SQL> SELECT st.*
2 FROM t_senttsk st INNER JOIN (WITH t_mrgdusr AS (SELECT DISTINCT usr_id
3 FROM t_usr
4 WHERE NVL(usr_mrgemstr, usr_id) = 10000002 /* i_payer_id */
5 )
6 SELECT t_senttsk.setk_id
7 FROM t_senttsk INNER JOIN t_mrgdusr
8 ON t_senttsk.setk_affn_memb = t_mrgdusr.usr_id
9 UNION
10 SELECT t_senttsk.setk_id
11 FROM t_senttsk INNER JOIN t_mrgdusr
12 ON t_senttsk.setk_ownr = t_mrgdusr.usr_id) t_affil
13 ON st.setk_id = t_affil.setk_id;
no rows selected
Elapsed: 00:13:14.54
Execution Plan
Plan hash value: 1241660758
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 169K| 64M| 1403 (3)| 00:00:17 |
| 1 | NESTED LOOPS | | 169K| 64M| 1403 (3)| 00:00:17 |
| 2 | TABLE ACCESS FULL | T_SENTTSK | 136K| 51M| 1400 (3)| 00:00:17 |
| 3 | VIEW | | 1 | 6 | 1 (0)| 00:00:01 |
| 4 | TEMP TABLE TRANSFORMATION | | | | | |
| 5 | LOAD AS SELECT | | | | | |
| 6 | TABLE ACCESS BY INDEX ROWID | T_USR | 1 | 8 | 1 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | IX_NVL_USR_MRGEMSTR_USR_ID | 1 | | 1 (0)| 00:00:01 |
| 8 | SORT UNIQUE | | | | | |
| 9 | UNION-ALL PARTITION | | | | | |
| 10 | NESTED LOOPS | | 1 | 25 | 3 (0)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID| T_SENTTSK | 1 | 12 | 1 (0)| 00:00:01 |
|* 12 | INDEX UNIQUE SCAN | PK_T_SENTTSK | 1 | | 1 (0)| 00:00:01 |
|* 13 | VIEW | | 1 | 13 | 2 (0)| 00:00:01 |
| 14 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6608_399116CE | 1 | 6 | 2 (0)| 00:00:01 |
| 15 | NESTED LOOPS | | 1 | 22 | 3 (0)| 00:00:01 |
|* 16 | TABLE ACCESS BY INDEX ROWID| T_SENTTSK | 1 | 9 | 1 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_T_SENTTSK | 1 | | 1 (0)| 00:00:01 |
|* 18 | VIEW | | 1 | 13 | 2 (0)| 00:00:01 |
| 19 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6608_399116CE | 1 | 6 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
7 - access(NVL("USR_MRGEMSTR","USR_ID")=10000002)
12 - access("T_SENTTSK"."SETK_ID"="ST"."SETK_ID")
13 - filter("T_SENTTSK"."SETK_AFFN_MEMB"="T_MRGDUSR"."USR_ID")
16 - filter("T_SENTTSK"."SETK_OWNR" IS NOT NULL)
17 - access("T_SENTTSK"."SETK_ID"="ST"."SETK_ID")
18 - filter("T_SENTTSK"."SETK_OWNR"="T_MRGDUSR"."USR_ID")
Statistics
349 recursive calls
275041 db block gets
1239881 consistent gets
26 physical reads
52730252 redo size
3312 bytes sent via SQL*Net to client
240 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
136835 sorts (memory)
0 sorts (disk)
0 rows processed
SQL> SELECT /*+ gather_plan_statistics */ st.*
2 FROM t_senttsk st INNER JOIN (WITH t_mrgdusr AS (SELECT DISTINCT usr_id
3 FROM t_usr
4 WHERE NVL(usr_mrgemstr, usr_id) = 10000002 /* i_payer_id */
5 )
6 SELECT t_senttsk.setk_id
7 FROM t_senttsk INNER JOIN t_mrgdusr
8 ON t_senttsk.setk_affn_memb = t_mrgdusr.usr_id
9 UNION
10 SELECT t_senttsk.setk_id
11 FROM t_senttsk INNER JOIN t_mrgdusr
12 ON t_senttsk.setk_ownr = t_mrgdusr.usr_id) t_affil
13 ON st.setk_id = t_affil.setk_id;
no rows selected
Elapsed: 00:09:15.90
SQL>
SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID 2rc9d2c83a7ak, child number 0
SELECT /*+ gather_plan_statistics */ st.* FROM t_senttsk st INNER JOIN (WITH t_mrgdusr AS (SELECT DISTINCT usr_id
FROM t_usr WHERE NVL(usr_mrgemstr, usr_id) = :"SYS_B_0"
/* i_payer_id */ )
SELECT t_senttsk.setk_id FROM t_senttsk INNER JOIN t_mrgdusr
ON t_senttsk.setk_affn_memb = t_mrgdusr.usr_id UNION SELECT
t_senttsk.setk_id FROM t_senttsk INNER JOIN t_mrgdusr ON
t_senttsk.setk_ownr = t_mrgdusr.usr_id) t_affil ON st.setk_id = t_affil.setk_id
Plan hash value: 1065206678
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
| 1 | NESTED LOOPS | | 1 | 169K| 0 |00:09:02.47 | 1514K| | | |
| 2 | TABLE ACCESS FULL | T_SENTTSK | 1 | 136K| 136K|00:00:01.64 | 7062 | | | |
| 3 | VIEW | | 136K| 1 | 0 |00:09:00.54 | 1507K| | | |
| 4 | TEMP TABLE TRANSFORMATION | | 136K| | 0 |00:09:00.12 | 1507K| | | |
| 5 | LOAD AS SELECT | | 136K| | 0 |00:08:24.31 | 548K| 1024 | 1024 | |
| 6 | TABLE ACCESS BY INDEX ROWID | T_USR | 136K| 1 | 0 |00:00:06.12 | 410K| | | |
|* 7 | INDEX RANGE SCAN | IX_NVL_USR_MRGEMSTR_USR_ID | 136K| 1 | 0 |00:00:05.41 | 410K| | | |
| 8 | SORT UNIQUE | | 136K| | 0 |00:00:19.10 | 822K| 1024 | 1024 | |
| 9 | UNION-ALL PARTITION | | 136K| | 0 |00:00:17.40 | 822K| | | |
| 10 | NESTED LOOPS | | 136K| 1 | 0 |00:00:08.02 | 411K| | | |
| 11 | TABLE ACCESS BY INDEX ROWID| T_SENTTSK | 136K| 1 | 136K|00:00:06.36 | 411K| | | |
|* 12 | INDEX UNIQUE SCAN | PK_T_SENTTSK | 136K| 1 | 136K|00:00:03.68 | 273K| | | |
|* 13 | VIEW | | 136K| 1 | 0 |00:00:01.03 | 0 | | | |
| 14 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6609_399116CE | 136K| 1 | 0 |00:00:00.67 | 0 | | | |
| 15 | NESTED LOOPS | | 136K| 1 | 0 |00:00:06.54 | 411K| | | |
|* 16 | TABLE ACCESS BY INDEX ROWID| T_SENTTSK | 136K| 1 | 34256 |00:00:05.87 | 411K| | | |
|* 17 | INDEX UNIQUE SCAN | PK_T_SENTTSK | 136K| 1 | 136K|00:00:03.46 | 273K| | | |
|* 18 | VIEW | | 34256 | 1 | 0 |00:00:00.25 | 0 | | | |
| 19 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6609_399116CE | 34256 | 1 | 0 |00:00:00.16 | 0 | | | |
Predicate Information (identified by operation id):
7 - access("T_USR"."SYS_NC00127$"=:SYS_B_0)
12 - access("T_SENTTSK"."SETK_ID"="ST"."SETK_ID")
13 - filter("T_SENTTSK"."SETK_AFFN_MEMB"="T_MRGDUSR"."USR_ID")
16 - filter("T_SENTTSK"."SETK_OWNR" IS NOT NULL)
17 - access("T_SENTTSK"."SETK_ID"="ST"."SETK_ID")
18 - filter("T_SENTTSK"."SETK_OWNR"="T_MRGDUSR"."USR_ID")
hoek wrote:Does rewriting 'the heart of the issue' into like below make any difference?
select a.*
from foo a
where exists ( select null
from bar b
where a.foo_pk_id = b.foo_pk_id
and b.some_col = :bind_var
The UNION in the subquery seems to make that difficult. -
Sudden improvement in Performance
Hi,
Other day we reduced flash cache to 180 G from 560 (as per the doc, flash cache should be between 2 to 10 times of the SGA,our case it's 24 g)
After that performance improved considerably.I came to know that the sudden enhancement was due to release of certain amount of
memory which was held for storing the details of the blocks in the flash cache
i.e
For every block flash cache , at least 200 bytes (2.4%) are reserved in buffer cache for keeping the metadata .
So in the earlier case (flash cache as 560 g)
560 *2.4% =13.44 g is reserved in the db cache.But after the reduction to 180 it became 4.32 .
So shall I assume that this increase of 9 g in db cache is the sole reason for the sudden improvement in performance?
Anybody having any different idea ,please share ...
Platform OEL 5.5
Version 11.2.0.2 (3 node RAC)
db_block_size 8192
Regards
Joshy MathewCould you please run the BT Speedtester via a WIRED CAT5 connection and post your results.
BT Infinity (EASTF) 58.93/15.94 Mbps [IP Profile: 60.8/20 Mbps] using Openreach Modem & Billion BiPAC 7800N -
For all entries changes the order of the itab
Hi Experts
In the following query i have used two internal tables namely it_first and it_zlist.
The material inwhich the it_zlist is different sorting order
After executing this query, the order of the material inwhich the it_first is different from the it_zlist.
What could be the reason, pls explain me on this.
select matnr test zsno ztnam from zmaster1
into corresponding fields of table it_first
for all entries in it_zlist
where matnr = it_zlist-matnr.
Thanks in advance.
Regards
Rajaramfor all entries u should specified all primary key.
sort by u condition.
Effect
If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with relational operators.
The internal table itab must have a structured line type and the component comp must be compatible with the column col.
The logical expression sql_cond of the WHERE condition can comprise various logical expressions by using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one Comparison with a column of the internal table itab, which can be specified either statistically or dynamically (Release 6.40 and higher). In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY.
The whole logical expression sql_cond is evaluated for each individual line of the internal table itab. The resulting set of the SELECT statement is the union of the resulting sets from the individual evaluations. Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set.
Notes
In Release 6.10 and higher, the same internal table can be specified after FOR ALL ENTRIES and after INTO.
The addition FOR ALL ENTRIES is only possible before WHERE conditions of the SELECT statement.
If the additions PACKAGE SIZE or UP TO n ROWS are specified together with FOR ALL ENTRIES, they are not passed to the database system but are applied instead to the resulting set once all selected rows on the application server have been imported.
With duplicated rows in the resulting set, the addition FOR ALL ENTRIES has the same effect as if addition DISTINCT were specified in the definition of the selection quantity. Unlike DISTINCT, the rows are not deleted from the database system but are deleted on the application server from the resulting set.
Addition FOR ALL ENTRIES is only possible for WHERE conditions of the SELECT statement.
Example
Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement. -
Does ios 7.1.1 improve battery performance ,also what is its effect on the speed of iphone 4s????
if it increase battery i want to know if it reduce the iphone speed ,as after ios 7.1 my iphone got more speed but the battery drainage increasedTx modular, I mean by speed the general performance of iPhone which optimized after iOS 7.1 but I am afraid to update to iOS 7.1.1 not to lose this perfect performance but also I need battery life optimization
Maybe you are looking for
-
[Feature Request] Option to disable auto-scrolling
LG Nexus 4, Android 4.4.4, Vodafone, Skype 5.0.0.52727 Please provide an option to get rid of that automatical scrolling to end of conversations when someone texts in it. Can't read older content on my Android phone when people keep writing.
-
What is the official AIR SDK and FLEX version to release for iOS6 ?
Hi, Wanted to know which AIR SDK and FLEX version is fully suporting the iOS6 to submit to Apple. I found that AIR SDK 3.4 is supporting iOS6, though the code created for iOS 6 is not working correctly when build from Flash Builder 4.7 AIR SDK 3.4 FL
-
File downloading problem: urgent
hai ! I want to download a attached file from mail. If i use the following code i can get the file but i can't get the content of file. following is my code try part = multipart.getBodyPart(aid); contenttype=part.getContentType();
-
Adobe Premiere Elements 9 Effects
I have and am using Adobe Premiere Elements 9. I want to use certain effects in my videos, but don't want them there throughout the whole course of the video. I just want them there at certain point's in the video. I am not sure how to do this and ca
-
SM01 - Limit locking to specific transactions
Hello, I'm a fairly new SAP Basis Admin and have been tasked with the following: "Hi Joe For finite scheduling we need Gary R and Mike D to have access to lock certain transactions and see what users are using those transactions. Can we therefore add