Oracle query to run at perticular time
I have below query..
SELECT * FROM POSTINGS
WHERE POST_DATE BETWEEN SYSDATE - 1 AND SYSDATE;
my condition always be sysdate -1 and sysdate, but I will be executing the report everyday at 11 p.m. How to I specify time with sysdate - 1. I wanted that to start from 6 p.m. Is is possible to specify time with sysdate?
Yesterday at 6 pm = trunc(sysdate-1)+18/24
SQL> select trunc(sysdate-1)+18/24 from dual;
TRUNC(SYSDATE-1)+18/24
+----------------------
2/7/2012 6:00:00 PM
Similar Messages
-
The query just run the first time, the second doesnt run
The query just run the first time, the second doesnt run, i checked it in the SM50 and appear this msg:
CL_RSR_CACHE_BO_FF============CP
its not a problem of indexes, i repaired it but its really weird cause the first time the query run ok, the second doesnt, it seems that the cache is confused or i dont know, help guys, i'll really appreciate itI was watching the notes, its really weird when i load the cube and execute the query for the first time, its ok, to the second stay in cache, but i was watching that the cube doesnt allow me activat the BD statistics, i dont know if this is necesary to improve the performance of the query, what i know is this:
1- before i create a Hierarchy for an infoobject thta is in the cube , the query used to run ok. Now when i load the first time and execute its ok, but the second stay in cache.
2- now i can activate the statistics for the cube, the indexes are ok, i checked for the RSRV and all is ok less the statistics.
what can i do help friends... -
Sql Query is running fine in one database but running from long in other
Hi All,
Please advice me on below:
One query is running fine on 11gr2 database with having 2GB SGA and cost of the running query is 15, but the same query is running from long time in other database having same 2GB SGA.
Below is teh Query:
SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
'SEQUENCE','SELECT', 'EXECUTE')||' on
'||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
"'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
AS GRANT_SOURCE, 'create or replace synonym
"'||CDU.USER_NAME||'"."'||:B1 ||'" for
"'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
Please advise me as application team is chasing me like anything. what I can find out is that Cost is different in both databases.Sorry forr Late reply friends..
below are the Explian plans for both databases:
BAD database
PLAN_TABLE_OUTPUT
SQL_ID 3bp3rynsds42r, child number 0
SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
'SEQUENCE','SELECT', 'EXECUTE')||' on
'||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
"'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
PLAN_TABLE_OUTPUT
AS GRANT_SOURCE, 'create or replace synonym
"'||CDU.USER_NAME||'"."'||:B1 ||'" for
"'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
Plan hash value: 2404940060
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | | 94 (100)| |
|* 1 | FILTER | | | | | | |
|* 2 | HASH JOIN | | 81 | 6723 | | 94 (0)| 00:00:01 |
| 3 | NESTED LOOPS OUTER | | 81 | 6480 | | 91 (0)| 00:00:01 |
|* 4 | HASH JOIN | | 81 | 3726 | | 10 (0)| 00:00:01 |
|* 5 | HASH JOIN | | 137 | 3699 | | 7 (0)| 00:00:01 |
| 6 | TABLE ACCESS FULL | TS$ | 7 | 21 | | 3 (0)| 00:00:01 |
|* 7 | TABLE ACCESS FULL | USER$ | 137 | 3288 | | 4 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 8 | TABLE ACCESS FULL | CD_USERS | 82 | 1558 | | 3 (0)| 00:00:01 |
| 9 | VIEW | ALL_SYNONYMS | 1 | 34 | | 1 (0)| 00:00:01 |
| 10 | SORT UNIQUE | | | | | | |
| 11 | UNION-ALL PARTITION | | | | | | |
|* 12 | FILTER | | | | | | |
| 13 | NESTED LOOPS | | 1 | 116 | | 60 (0)| 00:00:01 |
| 14 | NESTED LOOPS | | 1 | 94 | | 59 (0)| 00:00:01 |
| 15 | NESTED LOOPS | | 12 | 684 | | 23 (0)| 00:00:01 |
| 16 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
| 18 | TABLE ACCESS BY INDEX ROWID | SYN$ | 12 | 456 | | 22 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 19 | INDEX SKIP SCAN | I_SYN2 | 12 | | | 12 (0)| 00:00:01 |
|* 20 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 37 | | 3 (0)| 00:00:01 |
|* 21 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 23 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 24 | FILTER | | | | | | |
|* 25 | FILTER | | | | | | |
| 26 | NESTED LOOPS | | 27 | 2430 | | 6 (0)| 00:00:01 |
| 27 | NESTED LOOPS | | 1 | 78 | | 4 (0)| 00:00:01 |
| 28 | NESTED LOOPS | | 1 | 56 | | 3 (0)| 00:00:01 |
| 29 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 30 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 31 | INDEX RANGE SCAN | I_OBJ5 | 1 | 37 | | 2 (0)| 00:00:01 |
|* 32 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | I_OBJAUTH1 | 28 | 336 | | 2 (0)| 00:00:01 |
|* 34 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 35 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 36 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
| 38 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 39 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 40 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 41 | FILTER | | | | | | |
| 42 | NESTED LOOPS | | 1 | 129 | | 4301 (2)| 00:00:39 |
| 43 | NESTED LOOPS | | 1 | 129 | | 4301 (2)| 00:00:39 |
| 44 | NESTED LOOPS | | 1 | 91 | | 4299 (2)| 00:00:39 |
| 45 | NESTED LOOPS | | 1 | 69 | | 4298 (2)| 00:00:39 |
| 46 | NESTED LOOPS | | 2 | 64 | | 4292 (2)| 00:00:39 |
| 47 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
|* 48 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
| 49 | VIEW | _ALL_SYNONYMS_TREE | 2 | 26 | | 4291 (2)| 00:00:39 |
|* 50 | CONNECT BY NO FILTERING WITH START-WITH| | | | | | |
|* 51 | FILTER | | | | | | |
PLAN_TABLE_OUTPUT
|* 52 | HASH JOIN | | 18370 | 2080K| | 4291 (2)| 00:00:39 |
| 53 | INDEX FULL SCAN | I_USER2 | 207 | 4554 | | 1 (0)| 00:00:01 |
|* 54 | HASH JOIN | | 18370 | 1686K| | 4290 (2)| 00:00:39 |
| 55 | TABLE ACCESS FULL | USER$ | 207 | 3933 | | 4 (0)| 00:00:01 |
|* 56 | HASH JOIN | | 2922K| 209M| 18M| 4269 (1)| 00:00:39 |
|* 57 | INDEX FAST FULL SCAN | I_OBJ2 | 387K| 13M| | 1323 (1)| 00:00:12 |
| 58 | TABLE ACCESS FULL | SYN$ | 400K| 14M| | 566 (2)| 00:00:06 |
| 59 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 60 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 61 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
|* 62 | FILTER | | | | | | |
PLAN_TABLE_OUTPUT
| 63 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 38 | | 3 (0)| 00:00:01 |
|* 64 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 2 (0)| 00:00:01 |
|* 65 | FILTER | | | | | | |
|* 66 | FILTER | | | | | | |
| 67 | NESTED LOOPS | | 27 | 2430 | | 6 (0)| 00:00:01 |
| 68 | NESTED LOOPS | | 1 | 78 | | 4 (0)| 00:00:01 |
| 69 | NESTED LOOPS | | 1 | 56 | | 3 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
|* 71 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 72 | INDEX RANGE SCAN | I_OBJ5 | 1 | 37 | | 2 (0)| 00:00:01 |
|* 73 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 74 | INDEX RANGE SCAN | I_OBJAUTH1 | 28 | 336 | | 2 (0)| 00:00:01 |
|* 75 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 76 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 77 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 78 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
|* 79 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 80 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 37 | | 3 (0)| 00:00:01 |
|* 81 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 82 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 83 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 1 (0)| 00:00:01 |
|* 84 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 38 | | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 85 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 86 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 87 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
| 88 | TABLE ACCESS FULL | TS$ | 7 | 21 | | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter((:B2='TYPE' OR :B2='TABLE' OR :B2='VIEW' OR :B2='FUNCTION' OR :B2='PROCEDURE' OR :B2='PACKAGE' OR
:B2='SEQUENCE' OR :B2='QUEUE' OR :B2='SYNONYM'))
PLAN_TABLE_OUTPUT
2 - access("U"."TEMPTS#"="TTS"."TS#")
4 - access("CDU"."USER_NAME"="U"."NAME")
5 - access("U"."DATATS#"="DTS"."TS#")
7 - filter("U"."TYPE#"=1)
8 - filter("CDU"."USER_TYPE"='S')
12 - filter(((INTERNAL_FUNCTION("O"."SPARE3") OR ("S"."NODE" IS NULL AND IS NOT NULL) OR IS NOT NULL) AND
(("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND
"O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND
"O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND
"U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT
NULL)))
PLAN_TABLE_OUTPUT
17 - access("U"."NAME"="CDU"."USER_NAME")
19 - access("S"."NAME"=:B1)
filter("S"."NAME"=:B1)
20 - filter("O"."SPARE3"="U"."USER#")
21 - access("O"."OBJ#"="S"."OBJ#" AND "O"."TYPE#"=5)
filter("O"."TYPE#"=5)
22 - access("O"."OWNER#"="U"."USER#")
23 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
(-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
24 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
PLAN_TABLE_OUTPUT
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
25 - filter(:B1 IS NULL)
30 - access("BU"."NAME"=:B1)
31 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
32 - access("O"."OWNER#"="U"."USER#")
33 - access("BA"."OBJ#"="O"."OBJ#")
34 - filter("KZSROROL"=:B1)
36 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
PLAN_TABLE_OUTPUT
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
37 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
39 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
40 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
41 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
48 - access("U"."NAME"="CDU"."USER_NAME")
PLAN_TABLE_OUTPUT
50 - access("S"."BASE_SYN_ID"=PRIOR NULL)
filter( IS NOT NULL)
51 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
52 - access("O"."OWNER#"="U"."USER#")
54 - access("S"."OWNER"="BU"."NAME" AND "BU"."USER#"="O"."SPARE3")
56 - access("S"."NAME"="O"."NAME")
57 - filter("O"."TYPE#"=5)
PLAN_TABLE_OUTPUT
60 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
61 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
62 - filter(( IS NOT NULL OR ("S"."NODE" IS NULL AND IS NOT NULL)))
64 - access("S"."OBJ#"=:B1)
65 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
PLAN_TABLE_OUTPUT
66 - filter(:B1 IS NULL)
71 - access("BU"."NAME"=:B1)
72 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
73 - access("O"."OWNER#"="U"."USER#")
74 - access("BA"."OBJ#"="O"."OBJ#")
75 - filter("KZSROROL"=:B1)
77 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
78 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
79 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
(-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
PLAN_TABLE_OUTPUT
80 - filter("O"."SPARE3"="U"."USER#")
81 - access("O"."OBJ#"="ST"."SYN_ID" AND "O"."TYPE#"=5)
filter("O"."TYPE#"=5)
82 - access("O"."OWNER#"="U"."USER#")
83 - access("S"."OBJ#"="ST"."SYN_ID")
filter("O"."OBJ#"="S"."OBJ#")
84 - filter("S"."NAME"=:B1)
86 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
87 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
209 rows selected
==============================================================================================
Good one
PLAN_TABLE_OUTPUT
SQL_ID 3bp3rynsds42r, child number 0
SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
'SEQUENCE','SELECT', 'EXECUTE')||' on
'||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
"'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
PLAN_TABLE_OUTPUT
AS GRANT_SOURCE, 'create or replace synonym
"'||CDU.USER_NAME||'"."'||:B1 ||'" for
"'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
Plan hash value: 2146531909
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | | 15 (100)| |
|* 1 | FILTER | | | | | | |
| 2 | NESTED LOOPS OUTER | | 3 | 273 | | 15 (0)| 00:00:01 |
| 3 | NESTED LOOPS | | 3 | 153 | | 12 (0)| 00:00:01 |
| 4 | NESTED LOOPS | | 3 | 144 | | 9 (0)| 00:00:01 |
| 5 | NESTED LOOPS | | 3 | 135 | | 6 (0)| 00:00:01 |
|* 6 | TABLE ACCESS FULL | USER$ | 55 | 1375 | | 4 (0)| 00:00:01 |
|* 7 | TABLE ACCESS BY INDEX ROWID | CD_USERS | 1 | 20 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 8 | INDEX UNIQUE SCAN | I1_CD_USERS | 1 | | | 0 (0)| |
| 9 | TABLE ACCESS CLUSTER | TS$ | 1 | 3 | | 1 (0)| 00:00:01 |
|* 10 | INDEX UNIQUE SCAN | I_TS# | 1 | | | 0 (0)| |
| 11 | TABLE ACCESS CLUSTER | TS$ | 1 | 3 | | 1 (0)| 00:00:01 |
|* 12 | INDEX UNIQUE SCAN | I_TS# | 1 | | | 0 (0)| |
| 13 | VIEW | ALL_SYNONYMS | 1 | 40 | | 1 (0)| 00:00:01 |
| 14 | SORT UNIQUE | | | | | | |
| 15 | UNION-ALL PARTITION | | | | | | |
|* 16 | FILTER | | | | | | |
| 17 | NESTED LOOPS | | 1 | 116 | | 19 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | 1 | 94 | | 18 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 19 | NESTED LOOPS | | 1 | 56 | | 15 (0)| 00:00:01 |
| 20 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
|* 21 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
| 22 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 36 | | 14 (0)| 00:00:01 |
|* 23 | INDEX SKIP SCAN | I_SYN2 | 1 | | | 12 (0)| 00:00:01 |
|* 24 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 38 | | 3 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 26 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 27 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 28 | FILTER | | | | | | |
|* 29 | FILTER | | | | | | |
PLAN_TABLE_OUTPUT
| 30 | NESTED LOOPS | | 3 | 279 | | 5 (0)| 00:00:01 |
| 31 | NESTED LOOPS | | 1 | 80 | | 4 (0)| 00:00:01 |
| 32 | NESTED LOOPS | | 1 | 58 | | 3 (0)| 00:00:01 |
| 33 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
|* 34 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 35 | INDEX RANGE SCAN | I_OBJ5 | 1 | 38 | | 2 (0)| 00:00:01 |
|* 36 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN | I_OBJAUTH1 | 3 | 39 | | 1 (0)| 00:00:01 |
|* 38 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 39 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 40 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 41 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
| 42 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 43 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 44 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
|* 45 | FILTER | | | | | | |
| 46 | NESTED LOOPS | | 1 | 129 | | 1065 (1)| 00:00:13 |
| 47 | NESTED LOOPS | | 1 | 107 | | 1064 (1)| 00:00:13 |
| 48 | NESTED LOOPS | | 1 | 69 | | 1061 (1)| 00:00:13 |
| 49 | NESTED LOOPS | | 2 | 66 | | 1059 (1)| 00:00:13 |
| 50 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
PLAN_TABLE_OUTPUT
| 52 | VIEW | _ALL_SYNONYMS_TREE | 2 | 26 | | 1058 (1)| 00:00:13 |
|* 53 | CONNECT BY NO FILTERING WITH START-WITH| | | | | | |
|* 54 | FILTER | | | | | | |
|* 55 | HASH JOIN | | 705 | 81780 | | 1058 (1)| 00:00:13 |
| 56 | INDEX FULL SCAN | I_USER2 | 124 | 2728 | | 1 (0)| 00:00:01 |
|* 57 | HASH JOIN | | 705 | 66270 | | 1057 (1)| 00:00:13 |
| 58 | TABLE ACCESS FULL | USER$ | 124 | 2480 | | 4 (0)| 00:00:01 |
|* 59 | HASH JOIN | | 66964 | 4839K| 2232K| 1052 (1)| 00:00:13 |
| 60 | TABLE ACCESS FULL | SYN$ | 47615 | 1673K| | 78 (2)| 00:00:01 |
|* 61 | INDEX FAST FULL SCAN | I_OBJ5 | 47862 | 1776K| | 752 (1)| 00:00:10 |
| 62 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 63 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 64 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
|* 65 | FILTER | | | | | | |
| 66 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 36 | | 2 (0)| 00:00:01 |
|* 67 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 1 (0)| 00:00:01 |
|* 68 | FILTER | | | | | | |
|* 69 | FILTER | | | | | | |
| 70 | NESTED LOOPS | | 3 | 279 | | 5 (0)| 00:00:01 |
| 71 | NESTED LOOPS | | 1 | 80 | | 4 (0)| 00:00:01 |
| 72 | NESTED LOOPS | | 1 | 58 | | 3 (0)| 00:00:01 |
| 73 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 74 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 75 | INDEX RANGE SCAN | I_OBJ5 | 1 | 38 | | 2 (0)| 00:00:01 |
|* 76 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 77 | INDEX RANGE SCAN | I_OBJAUTH1 | 3 | 39 | | 1 (0)| 00:00:01 |
|* 78 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 79 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 80 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 81 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
|* 82 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 83 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 36 | | 1 (0)| 00:00:01 |
|* 84 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 0 (0)| |
PLAN_TABLE_OUTPUT
|* 85 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 38 | | 3 (0)| 00:00:01 |
|* 86 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 87 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
| 88 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 89 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 90 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - filter((:B2='TYPE' OR :B2='TABLE' OR :B2='VIEW' OR :B2='FUNCTION' OR :B2='PROCEDURE' OR :B2='PACKAGE' OR
:B2='SEQUENCE' OR :B2='QUEUE' OR :B2='SYNONYM'))
6 - filter("U"."TYPE#"=1)
7 - filter("CDU"."USER_TYPE"='S')
8 - access("CDU"."USER_NAME"="U"."NAME")
10 - access("U"."DATATS#"="DTS"."TS#")
12 - access("U"."TEMPTS#"="TTS"."TS#")
16 - filter(((INTERNAL_FUNCTION("O"."SPARE3") OR ("S"."NODE" IS NULL AND IS NOT NULL) OR IS NOT NULL) AND
(("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND
"O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND
"O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND
PLAN_TABLE_OUTPUT
"U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT
NULL)))
21 - access("U"."NAME"="CDU"."USER_NAME")
23 - access("S"."NAME"=:B1)
filter("S"."NAME"=:B1)
24 - filter("O"."SPARE3"="U"."USER#")
25 - access("O"."OBJ#"="S"."OBJ#" AND "O"."TYPE#"=5)
filter("O"."TYPE#"=5)
26 - access("O"."OWNER#"="U"."USER#")
27 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
(-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
PLAN_TABLE_OUTPUT
28 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
29 - filter(:B1 IS NULL)
34 - access("BU"."NAME"=:B1)
35 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
36 - access("O"."OWNER#"="U"."USER#")
37 - access("BA"."OBJ#"="O"."OBJ#")
PLAN_TABLE_OUTPUT
38 - filter("KZSROROL"=:B1)
40 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
41 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
43 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
44 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
45 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
PLAN_TABLE_OUTPUT
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
51 - access("U"."NAME"="CDU"."USER_NAME")
53 - access("S"."BASE_SYN_ID"=PRIOR NULL)
filter( IS NOT NULL)
54 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
55 - access("O"."OWNER#"="U"."USER#")
57 - access("S"."OWNER"="BU"."NAME" AND "BU"."USER#"="O"."SPARE3")
PLAN_TABLE_OUTPUT
59 - access("S"."NAME"="O"."NAME")
61 - filter("O"."TYPE#"=5)
63 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
64 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
65 - filter(( IS NOT NULL OR ("S"."NODE" IS NULL AND IS NOT NULL)))
67 - access("S"."OBJ#"=:B1)
68 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
PLAN_TABLE_OUTPUT
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
69 - filter(:B1 IS NULL)
74 - access("BU"."NAME"=:B1)
75 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
76 - access("O"."OWNER#"="U"."USER#")
77 - access("BA"."OBJ#"="O"."OBJ#")
78 - filter("KZSROROL"=:B1)
80 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
81 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TY -
Query in timesten taking more time than query in oracle database
Hi,
Can anyone please explain me why query in timesten taking more time
than query in oracle database.
I am mentioning in detail what are my settings and what have I done
step by step.........
1.This is the table I created in Oracle datababase
(Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
CREATE TABLE student (
id NUMBER(9) primary keY ,
first_name VARCHAR2(10),
last_name VARCHAR2(10)
2.THIS IS THE ANONYMOUS BLOCK I USE TO
POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
declare
firstname varchar2(12);
lastname varchar2(12);
catt number(9);
begin
for cntr in 1..2599999 loop
firstname:=(cntr+8)||'f';
lastname:=(cntr+2)||'l';
if cntr like '%9999' then
dbms_output.put_line(cntr);
end if;
insert into student values(cntr,firstname, lastname);
end loop;
end;
3. MY DSN IS SET THE FOLLWING WAY..
DATA STORE PATH- G:\dipesh3repo\db
LOG DIRECTORY- G:\dipesh3repo\log
PERM DATA SIZE-1000
TEMP DATA SIZE-1000
MY TIMESTEN VERSION-
C:\Documents and Settings\dipesh>ttversion
TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
Instance admin: dipesh
Instance home directory: G:\TimestTen\TT70_32
Daemon home directory: G:\TimestTen\TT70_32\srv\info
THEN I CONNECT TO THE TIMESTEN DATABASE
C:\Documents and Settings\dipesh> ttisql
command>connect "dsn=dipesh3;oraclepwd=tiger";
4. THEN I START THE AGENT
call ttCacheUidPwdSet('SCOTT','TIGER');
Command> CALL ttCacheStart();
5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
create readonly cache group rc_student autorefresh
interval 5 seconds from student
(id int not null primary key, first_name varchar2(10), last_name varchar2(10));
load cache group rc_student commit every 100 rows;
6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
I SET THE TIMING..
command>TIMING 1;
consider this query now..
Command> select * from student where first_name='2155666f';
< 2155658, 2155666f, 2155660l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
another query-
Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
2206: Table SCOTT.STUDENTS not found
Execution time (SQLPrepare) = 0.074964 seconds.
The command failed.
Command> SELECT * FROM STUDENT where first_name='2093434f';
< 2093426, 2093434f, 2093428l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
Command>
7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
ID FIRST_NAME LAST_NAME
1498663 1498671f 1498665l
Elapsed: 00:00:00.15
Can anyone please explain me why query in timesten taking more time
that query in oracle database.
Message was edited by: Dipesh Majumdar
user542575
Message was edited by:
user542575TimesTen
Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
Version: 7.0.4.0.0 64 bit
Schema:
create usermanaged cache group factCache from
MV_US_DATAMART
ORDER_DATE DATE,
IF_SYSTEM VARCHAR2(32) NOT NULL,
GROUPING_ID TT_BIGINT,
TIME_DIM_ID TT_INTEGER NOT NULL,
BUSINESS_DIM_ID TT_INTEGER NOT NULL,
ACCOUNT_DIM_ID TT_INTEGER NOT NULL,
ORDERTYPE_DIM_ID TT_INTEGER NOT NULL,
INSTR_DIM_ID TT_INTEGER NOT NULL,
EXECUTION_DIM_ID TT_INTEGER NOT NULL,
EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
NO_ORDERS TT_BIGINT,
FILLED_QUANTITY TT_BIGINT,
CNT_FILLED_QUANTITY TT_BIGINT,
QUANTITY TT_BIGINT,
CNT_QUANTITY TT_BIGINT,
COMMISSION BINARY_FLOAT,
CNT_COMMISSION TT_BIGINT,
FILLS_NUMBER TT_BIGINT,
CNT_FILLS_NUMBER TT_BIGINT,
AGGRESSIVE_FILLS TT_BIGINT,
CNT_AGGRESSIVE_FILLS TT_BIGINT,
NOTIONAL BINARY_FLOAT,
CNT_NOTIONAL TT_BIGINT,
TOTAL_PRICE BINARY_FLOAT,
CNT_TOTAL_PRICE TT_BIGINT,
CANCELLED_ORDERS_COUNT TT_BIGINT,
CNT_CANCELLED_ORDERS_COUNT TT_BIGINT,
ROUTED_ORDERS_NO TT_BIGINT,
CNT_ROUTED_ORDERS_NO TT_BIGINT,
ROUTED_LIQUIDITY_QTY TT_BIGINT,
CNT_ROUTED_LIQUIDITY_QTY TT_BIGINT,
REMOVED_LIQUIDITY_QTY TT_BIGINT,
CNT_REMOVED_LIQUIDITY_QTY TT_BIGINT,
ADDED_LIQUIDITY_QTY TT_BIGINT,
CNT_ADDED_LIQUIDITY_QTY TT_BIGINT,
AGENT_CHARGES BINARY_FLOAT,
CNT_AGENT_CHARGES TT_BIGINT,
CLEARING_CHARGES BINARY_FLOAT,
CNT_CLEARING_CHARGES TT_BIGINT,
EXECUTION_CHARGES BINARY_FLOAT,
CNT_EXECUTION_CHARGES TT_BIGINT,
TRANSACTION_CHARGES BINARY_FLOAT,
CNT_TRANSACTION_CHARGES TT_BIGINT,
ORDER_MANAGEMENT BINARY_FLOAT,
CNT_ORDER_MANAGEMENT TT_BIGINT,
SETTLEMENT_CHARGES BINARY_FLOAT,
CNT_SETTLEMENT_CHARGES TT_BIGINT,
RECOVERED_AGENT BINARY_FLOAT,
CNT_RECOVERED_AGENT TT_BIGINT,
RECOVERED_CLEARING BINARY_FLOAT,
CNT_RECOVERED_CLEARING TT_BIGINT,
RECOVERED_EXECUTION BINARY_FLOAT,
CNT_RECOVERED_EXECUTION TT_BIGINT,
RECOVERED_TRANSACTION BINARY_FLOAT,
CNT_RECOVERED_TRANSACTION TT_BIGINT,
RECOVERED_ORD_MGT BINARY_FLOAT,
CNT_RECOVERED_ORD_MGT TT_BIGINT,
RECOVERED_SETTLEMENT BINARY_FLOAT,
CNT_RECOVERED_SETTLEMENT TT_BIGINT,
CLIENT_AGENT BINARY_FLOAT,
CNT_CLIENT_AGENT TT_BIGINT,
CLIENT_ORDER_MGT BINARY_FLOAT,
CNT_CLIENT_ORDER_MGT TT_BIGINT,
CLIENT_EXEC BINARY_FLOAT,
CNT_CLIENT_EXEC TT_BIGINT,
CLIENT_TRANS BINARY_FLOAT,
CNT_CLIENT_TRANS TT_BIGINT,
CLIENT_CLEARING BINARY_FLOAT,
CNT_CLIENT_CLEARING TT_BIGINT,
CLIENT_SETTLE BINARY_FLOAT,
CNT_CLIENT_SETTLE TT_BIGINT,
CHARGEABLE_TAXES BINARY_FLOAT,
CNT_CHARGEABLE_TAXES TT_BIGINT,
VENDOR_CHARGE BINARY_FLOAT,
CNT_VENDOR_CHARGE TT_BIGINT,
ROUTING_CHARGES BINARY_FLOAT,
CNT_ROUTING_CHARGES TT_BIGINT,
RECOVERED_ROUTING BINARY_FLOAT,
CNT_RECOVERED_ROUTING TT_BIGINT,
CLIENT_ROUTING BINARY_FLOAT,
CNT_CLIENT_ROUTING TT_BIGINT,
TICKET_CHARGES BINARY_FLOAT,
CNT_TICKET_CHARGES TT_BIGINT,
RECOVERED_TICKET_CHARGES BINARY_FLOAT,
CNT_RECOVERED_TICKET_CHARGES TT_BIGINT,
PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
READONLY);
No of rows: 2228558
Config:
< CkptFrequency, 600 >
< CkptLogVolume, 0 >
< CkptRate, 0 >
< ConnectionCharacterSet, US7ASCII >
< ConnectionName, tt_us_dma >
< Connections, 64 >
< DataBaseCharacterSet, AL32UTF8 >
< DataStore, e:\andrew\datacache\usDMA >
< DurableCommits, 0 >
< GroupRestrict, <NULL> >
< LockLevel, 0 >
< LockWait, 10 >
< LogBuffSize, 65536 >
< LogDir, e:\andrew\datacache\ >
< LogFileSize, 64 >
< LogFlushMethod, 1 >
< LogPurge, 0 >
< Logging, 1 >
< MemoryLock, 0 >
< NLS_LENGTH_SEMANTICS, BYTE >
< NLS_NCHAR_CONV_EXCP, 0 >
< NLS_SORT, BINARY >
< OracleID, NYCATP1 >
< PassThrough, 0 >
< PermSize, 4000 >
< PermWarnThreshold, 90 >
< PrivateCommands, 0 >
< Preallocate, 0 >
< QueryThreshold, 0 >
< RACCallback, 0 >
< SQLQueryTimeout, 0 >
< TempSize, 514 >
< TempWarnThreshold, 90 >
< Temporary, 1 >
< TransparentLoad, 0 >
< TypeMode, 0 >
< UID, OS_OWNER >
ORACLE:
Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
Schema:
CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
TABLESPACE TS_OS
PARTITION BY RANGE (ORDER_DATE)
PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE TS_OS
NOCACHE
NOCOMPRESS
NOPARALLEL
BUILD DEFERRED
USING INDEX
TABLESPACE TS_OS_INDEX
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT order_date, if_system,
GROUPING_ID (order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id
) GROUPING_ID,
/* ============ DIMENSIONS ============ */
time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
instr_dim_id, execution_dim_id, exec_exchange_dim_id,
/* ============ MEASURES ============ */
-- o.FX_RATE /* FX_RATE */,
COUNT (*) no_orders,
-- SUM(NO_ORDERS) NO_ORDERS,
-- COUNT(NO_ORDERS) CNT_NO_ORDERS,
SUM (filled_quantity) filled_quantity,
COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
COUNT (quantity) cnt_quantity, SUM (commission) commission,
COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
COUNT (fills_number) cnt_fills_number,
SUM (aggressive_fills) aggressive_fills,
COUNT (aggressive_fills) cnt_aggressive_fills,
SUM (fx_rate * filled_quantity * average_price) notional,
COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
SUM (fx_rate * fills_number * average_price) total_price,
COUNT (fx_rate * fills_number * average_price) cnt_total_price,
SUM (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END) cancelled_orders_count,
COUNT (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END
) cnt_cancelled_orders_count,
-- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
-- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
-- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
SUM (routed_orders_no) routed_orders_no,
COUNT (routed_orders_no) cnt_routed_orders_no,
SUM (routed_liquidity_qty) routed_liquidity_qty,
COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
SUM (removed_liquidity_qty) removed_liquidity_qty,
COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
SUM (added_liquidity_qty) added_liquidity_qty,
COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
SUM (agent_charges) agent_charges,
COUNT (agent_charges) cnt_agent_charges,
SUM (clearing_charges) clearing_charges,
COUNT (clearing_charges) cnt_clearing_charges,
SUM (execution_charges) execution_charges,
COUNT (execution_charges) cnt_execution_charges,
SUM (transaction_charges) transaction_charges,
COUNT (transaction_charges) cnt_transaction_charges,
SUM (order_management) order_management,
COUNT (order_management) cnt_order_management,
SUM (settlement_charges) settlement_charges,
COUNT (settlement_charges) cnt_settlement_charges,
SUM (recovered_agent) recovered_agent,
COUNT (recovered_agent) cnt_recovered_agent,
SUM (recovered_clearing) recovered_clearing,
COUNT (recovered_clearing) cnt_recovered_clearing,
SUM (recovered_execution) recovered_execution,
COUNT (recovered_execution) cnt_recovered_execution,
SUM (recovered_transaction) recovered_transaction,
COUNT (recovered_transaction) cnt_recovered_transaction,
SUM (recovered_ord_mgt) recovered_ord_mgt,
COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
SUM (recovered_settlement) recovered_settlement,
COUNT (recovered_settlement) cnt_recovered_settlement,
SUM (client_agent) client_agent,
COUNT (client_agent) cnt_client_agent,
SUM (client_order_mgt) client_order_mgt,
COUNT (client_order_mgt) cnt_client_order_mgt,
SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
SUM (client_trans) client_trans,
COUNT (client_trans) cnt_client_trans,
SUM (client_clearing) client_clearing,
COUNT (client_clearing) cnt_client_clearing,
SUM (client_settle) client_settle,
COUNT (client_settle) cnt_client_settle,
SUM (chargeable_taxes) chargeable_taxes,
COUNT (chargeable_taxes) cnt_chargeable_taxes,
SUM (vendor_charge) vendor_charge,
COUNT (vendor_charge) cnt_vendor_charge,
SUM (routing_charges) routing_charges,
COUNT (routing_charges) cnt_routing_charges,
SUM (recovered_routing) recovered_routing,
COUNT (recovered_routing) cnt_recovered_routing,
SUM (client_routing) client_routing,
COUNT (client_routing) cnt_client_routing,
SUM (ticket_charges) ticket_charges,
COUNT (ticket_charges) cnt_ticket_charges,
SUM (recovered_ticket_charges) recovered_ticket_charges,
COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
FROM us_datamart_raw
GROUP BY order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id;
-- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
-- by Oracle with the associated materialized view.
CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
NOLOGGING
NOPARALLEL
COMPRESS 7;
No of rows: 2228558
The query (taken Mondrian) I run against each of them is:
select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
--, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
--, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
--, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
--, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
--, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
--, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
--, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
--, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
--, sum("MV_US_DATAMART"."COMMISSION") as "m9"
--, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
--, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
--,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
--,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
--, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
--, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
--, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
--, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
--,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
--, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
No Columns ORACLE TimesTen
1 1.05 0.94
2 1.07 1.47
3 2.04 1.8
4 2.06 2.08
5 2.09 2.4
6 3.01 2.67
7 4.02 3.06
8 4.03 3.37
9 4.04 3.62
10 4.06 4.02
11 4.08 4.31
12 4.09 4.61
13 5.01 4.76
14 5.02 5.06
15 5.04 5.25
16 5.05 5.48
17 5.08 5.84
18 6 6.21
19 6.02 6.34
20 6.04 6.75 -
Oracle Sql Query issue Running on Different DB Version
Hello All,
I have come into situation where we are pruning sql queries on different DB version of Oracle and have performance issue. Let me tell you in brief and i really appreciate for your prompt response as its very imperative stuff.
I have a query which is running on a DB of version 7.3.4 and it takes around 30 mins where as the same query when run on 8i it takes 15sec., its a huge difference. I have run the statistics to analyze on 7.3 and its comparatively very high. Question here is, the sql query trys to select data from same schema table and 2 tables from another DB using DB link and 2 other tables from another DB using DB link.So,how can we optimize this stuff and achieve this run as same time as 8i DB in 7.3. Hope i am clear about my question, Eagerly waiting for your replies.
Thanks in Advance.
Message was edited by:
Ram8Difficult to be sure without any more detailed information, but I suspect that O7 is in effect copying the remote tables to local temp space, then joining; 8i is factoring out a better query to send to the remote DBs, which does as much work as possible on the remote DB before shipping remaining rows back to local.
You should be able to use EXPLAIN PLAN to identify what SQL is being shipped to the remote DB, If you can't (and it's been quite a while since I tried DB links or O7) then get the remote DBs to yourself, and set SQL_TRACE on for the remote instances. Execute the query and then examine the remote trace files, And don't forget to turn off the tracing when you're done.
Of course it could just be that the CBO got better,,,
HTH - if not, post your query and plans for the local db, and the remote queries.
Regards Nigel -
Oracle Query runs very slow filling table
I have used Java Studio Creator 2 with Sun Java System Application Server Platform Edition 8.1_02 (build b06-fcs) in the past. I created a simple oracle query to populate a table and displaying about 560 rows in a table via a web browser. This runs excellent.
Now, I use Netbeans 6, along with Sun Java System Application Server 9.1 (build b58g-fcs), I populate a table using the same query as before and it takes quite a long time to fill the table. Actually, the browser keeps asking if I want to stop the script about 6 times. If I keep saying yes, it eventually completes.
I'm using an Oracle 9i database and have tried different drivers from Oracle with the same results.
Any idea why the difference in filling the table or how to correct this? Thanks!
Please note: I have this same question posted in the Java.net forums but it's not been answered so far, I hope this isn't crossposting and I get yelled at!for NetBeans questions I suggest posting your question in the [email protected] For more information:
http://www.netbeans.org/community/index.html -
How to get report (SQL Query) generating Run Time
There is a Standard report of Payroll which show employee transfer information on the bases of location, grade job or organization, now to get actual query which is generated by run time in report builder including whether single column parameter or lexical parameter " because currently the query in not complicate but the parameter and lexical parameter is much more due to this not quite easy to under stand just copy past it into toad or pl/sql developer,
Kindly share your experience to get such kind of query in you working time.
thanksHere i try to explain contain of query.
Parameter
P_DEPTNO = 10
P_WHERE_CLAUSE := ' AND EMPNO IS NOT NULL AND SALARY > 100'
SELECT * FROM EMP
WHERE DEPTNO = P_DEPTNO
&P_WHERE_CLAUSE
REPROT WILL GENERATE QUERY AT RUN TIME IS LIKE THAT
SELECT * FROM EMP
WHERE DEPTNO = 10
AND EMPNO IS NOT NULL AND SALARY > 100
Now i want to get this query out(Run time) by doing any oracle database feature or sth similar.
thanks -
Query to show last time a query was run
I am trying to write a query that will show me the last date/time a specific query was run. I have looked into v$sql and I can find the query, but from what I can tell it does not show the last time the query was executed.
Hi,
use v$sqlarea instead of v$sql and look at the column last_active_time. See also the documentation (docs.oracle.com/cd/E11882_01/server.112/e40402/title.htm) on the dynamic performance views in the database.
You will get more answers, however, if you put your question to the forum Oracle Database > SQL and PL/SQL .
Regards,
Gudrun Pabst -
Connect by level query is taking too long time to run
Hello,
I have a query that returns quarters (YYYYQ) of a begin- and enddate within a specific id, that is built with a connect by level clause, but the query is running to long. I have used explain plan to see what the query is doing, but no silly things to see, just a full table scan, with low costs.
This is the query:
select to_char(add_months( cpj.crpj_start_date,3*(level - 1)),'YYYYQ') as sales_quarter
, cpj.crpj_id as crpj_id
from mv_gen_cra_projects cpj
where cpj.crpj_start_date >= to_date('01/01/2009','mm/dd/yyyy')
and cpj.crpj_start_date <= cpj.crpj_end_date
and cpj.crpj_routing_type = 'A'
and ( cpj.crpj_multi_artist_ind = 'N'
or cpj.crpj_multi_artist_ind is null)
connect by level <= 1 + ceil(months_between(cpj.crpj_end_date,cpj.crpj_start_date)/3);
The result have to be like this:
SALES_QUARTER CRPJ_ID
20091 100
20092 100
20093 100
20094 100
20101 100
20102 100
Can anyone help me out with this?but no silly things to see, just a full table scan, with low costs.Well, maybe an index scan would be faster?
However:
You will need to provide us some more details, like:
- database version (the result of: SQL> select * from v$version;)
- post the explain plan output (put the tag before and after it, so indentation and formatting are maintained, see the [FAQ|http://forums.oracle.com/forums/help.jspa] for more explanation regarding tags )
- what are your optimizer settings (the result of: SQL> show parameter optimizer)
- if applicable: are your table statistics up to date?
- mv_gen_cra_projects is a materialized view perhaps?
Edited by: hoek on Jan 26, 2010 10:50 AM -
Query can run in Oracle 10g but very slow in 11g
Hi,
We've just migrated to Oracle 11g and we noticed that some of our view are very slow (it takes seconds in 10g and takes 30 minutes in 11g), and the tables are using the local table.
Do any of you face the same issue?
This is our query:
SELECT
A.wellbore
,a.depth center
,d.MD maxbc
,d.XDELT xbc
,d.YDELT ybc
,e.MD minac
,e.XDELT xac
,e.YDELT yac
from
table_A d,table_A e, table_B a
where a.wellbore = d.WELLBORE (+)
and a.wellbore = e.WELLBORE(+)
and d.MD = (select max(MD) from table_A b where b.MD < a.depth and
d.wellBORE = b.wellBORE)
and e.md = (select min(md) from table_A c where c.MD > a.depth and
e.wellBORE = c.wellBORE);Thanks I will move to the correct one..
Rafi,
Build the Indexes and it is still slow. I am querying from a view from another database, which is in 10g instances.
Moved: Query can run in Oracle 10g but very slow in 11g
Edited by: 924400 on Apr 1, 2012 6:03 PM
Edited by: 924400 on Apr 1, 2012 6:26 PM -
Query runs slowly and times out in CF 8
I'm trying to run this query using Coldfusion 8 and MySQL 5.
If I run the query directly off the database the results are
returned very quickly.
If I run the query through CF 7, it's pretty slow but still
runs. If I run the query through CF 8 it takes FOREVER, then times
out.
Any ideas what could be going wrong here?
I'm no DB expert. But if the query can run quickly directly
off the DB OK, but then bombs out in CF 8, that the problem might
be with CF 8 itself?
<cfquery name="theOrders"
datasource="#Application.ds#">
SELECT o.orderid, o.dealer, o.dealerRep, o.dealerPO,
o.dealerShippingInstructions, o.dealerFreightCollect,
o.othershipping, o.billoflading, o.carrier, o.othercarrier,
o.serialno, o.ShippingDate, o.Shipping, o.ShippingTotal,
o.SaleSubTotal, o.SaleTotal, o.Tax, o.Discount, o.DiscountRate,
o.Status, o.DateIn, o.bFirstName, o.bLastName, o.bAddress1,
o.bAddress2, o.bCity, o.bState, o.bZip, o.bPhone, o.sFirstName,
o.sLastName, o.sAddress1, o.sAddress2, o.sCity, o.sState, o.sZip,
o.sPhone, o.sPhone2, o.Message, o.dealerShippingInstructions,
o.bCompany, o.sCompany, o.bEmail, o.ipaddress, o.oAuthorization,
o.CCType, o.CCNum, o.CCName, o.CCYear, o.CCMonth, o.entryDate,
i.RelProductID, i.Quantity, i.RelUnitPrice, i.Shipping, i.Discount,
i.title
FROM tblorders as o, tblorderitems as i
WHERE o.OrderID=i.Relorderid
ORDER BY OrderID ASC
</cfquery>The server monitoring tool that is built in CF8 can help
debug this issue quickly. It can give you report about query
execution time, time taken by a tag to execute and lot more other
details.
You can launch sevrer monitoring via CF Administrator. -
Can you run Embedded PL/SQL Gateway and Oracle HTTP Server at the same time
Hi,
I know this will sound a bit odd but their is a business case for asking this. Can you run APEX via the Embedded PL/SQL Gateway and the Oracle HTTP Server at the same time? Would their be any security/stability/etc issues I'd need to worry about? I know that I'll need to run them on different ports.
Thank you,
Martin Giffy D'Souza
[http://apex-smb.blogspot.com/]I think I've done this in the past. Theres no technical reason why you can't do this as far as I know.
I can't remember if I used different ports or same port. -
How to set vo query at run time
Hi,
Is it possible to bind the where clause of query at run time.
N :)Hi,
Yes its possible.
To add new where clause to your query.
vo.setWhereClause(null);//If you want to remove any existing programmatically added where clause.
vo.setWhereClause("Your new query");
To bind varibales (Say there are 2 bind variables),
First way to achieve this.
setWhereClauseParam(null); //Always reset it to remove existing bindings)
setWhereClauseParam(0, "Your first paramter value"); // Second parameter "Your first paramter value" is of type object.
setWhereClauseParam(1, "Your first paramter value");
In case you use "?" styly type binding, this count in above method starts with 1 instead of 0.
Second way is to put all bind variables in an object array and pass to above method.
Vector params=new Vector(2);
params.addElement("FirstParameter");
params.addElement("SecondParameter");
Now call vo.executeQuery() to fetch the results as per new query.
Abdul Wahid -
I am new to this and a bit rusty with Java, Oracle, Web Development, et al; and, I need a free trial run at this time, Can we do this?
your itunes accoutn have nothing to d with your computer
you can go to any computer with internet access in the world and
login into your itunes account if you have the appleID and password
the itunes account is placed on apples itunes servers -
Oracle query running very slow
Hi,
We've MS-Access application which was pointing to UDB. Now we migrated it to point Oracle DB 9.2. After migration some of the query is running very slow.
These queries used to take less than 30 seconds in UDB now taking more than 5 Minutes in Oracle.
some more obeservation :
(1) Some of the queries using "HAVING" clause without any aggregate function. When I moved this condition to "WHERE" clause, performance improved a lot.
But problem is that I can't suggest this solution to "USERS". They are creating query using "query wizard" in MS-Access and they started creating noise on this.
(2) I tested same MDB in two different PCs and same query is returning records in 4 seconds in one system, is taking more than 10 minutes in other system.
Since I'm new to MS-Access, I don't know what other information I need to provide here.
Please help me out.ms wrote:
Hi All
I am using Oracle 11g . My table contains 10-12 lac rows.Do not use the word lac: it is common in the Indian sub-continent but not known much outside of
there because it is not standard English.
>
1) what is the difference between a index on one column and an index of number of columns ( i.e composite index). The obvious answer of one contains only one column and the other contains more than one.
2) For what columns in a where clause should index be created ( single columns index or composite index ).Depends
3) Also can u suggest how to improve the perfomane of thsi query?Please read: SQL and PL/SQL FAQ
which tells you how to ask a performance related question
Maybe you are looking for
-
Can't verify disk permissions (or get wireless to work) with SR macbook
Anybody else on an SR macbook wanna try verifying their disk permissions and tell me if it works? Also I have the ubiquitous airport problem (it just plain doesn't work). I used to have a mid 2006 revision and it worked flawlessly (until someone stol
-
./opmnctl status shows
Hi OAS ./opmnctl status shows ./opmnctl: line 1: /oracle/OracleAS/opmn: is a directory but components shows up in EM console unable to check the system componenets status by using command ./opmnctl status Thanks,
-
Need Help again...
Hi all... Really need help again this time... I am trying to do a web page and thought of placing 4 video clips into 1 Loader...viewers can simply choose any of the videos they would like to watch...and all the video clips will then play in the same
-
XI Message size - recommendation
Hi, I have a question regarding the message size of xi payload. I'm working on a scenario, sending 1.500.000 datarows via client proxy to xi for further processing. as i don't wanna have 1.500.000 messages in xi, i want to group the messages. can you
-
How I Can Close a Adf Calendar Popup in my managed bean ?
Hi. I am using Adf Calendar. When i call the method to close popup: public static void hidePopUp(RichPopup popUp) { FacesContext facesContext = FacesContext.getCurrentInstance(); ExtendedRenderKitService service = Service.getRenderKitService(facesCon