SQL Query Tuning
I have a question that needs to be tuned... This query is executed a lot of time during the day so total run time is high... Here are the detailsqUERY
SELECT col1 , col2 , col3 FROM table1 WHERE col4 = '200' AND
col2 IN ('123ABC','234/AF','AKJF/R','67KJAF/S','AD45/R')
AND COL1 IN ('NEWY','OHIO','WADC','CALI','PHYL','ILLI')
AND COL5 = ' ';
SQL> select banner from v$version
2 ;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for Solaris: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
SQL> select banner from v$version
2 ;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for Solaris: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
SQL> SHOW PARAMETER OPTIMIZER
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_optimizer_mjc_enabled boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.2.0.2
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 20
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
SQL> show parameter db_file_multi
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_multiblock_read_count integer 128
SQL> show parameter cursor_sharing
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing string EXACT
SQL> column sname format a20
SQL> column pname format a20
SQL>column pval2 format a20
select sname, pname, pval1, pval2
SQL> from sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
-------------------- -------------------- ---------- --------------------
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 11-10-2009 13:57
SYSSTATS_INFO DSTOP 11-10-2009 13:57
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 1417.876
SYSSTATS_MAIN IOSEEKTIM 11.022
SYSSTATS_MAIN IOTFRSPEED 15576.989
SYSSTATS_MAIN SREADTIM 2.844
SYSSTATS_MAIN MREADTIM .829
SYSSTATS_MAIN CPUSPEED 715
SYSSTATS_MAIN MBRC 8
SNAME PNAME PVAL1 PVAL2
-------------------- -------------------- ---------- --------------------
SYSSTATS_MAIN MAXTHR 19869696
SYSSTATS_MAIN SLAVETHR
13 rows selected.
SQL> explain plan for SELECT col1 , col2 , col3 FROM table1 WHERE col4 = '200' AND
col2 IN ('123ABC','234/AF','AKJF/R','67KJAF/S','AD45/R')
AND COL1 IN ('NEWY','OHIO','WADC','CALI','PHYL','ILLI')
AND COL5 = ' ';
4
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 27 | 783 | 12 (9)|
| 1 | INLIST ITERATOR | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TABLE1 | 27 | 783 | 11 (0)|
| 3 | INDEX RANGE SCAN | INDEX1 | 27 | | 7 (0)|
----------------------------------------------------------------------------
Note
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
-----
- 'PLAN_TABLE' is old version
13 rows selected.
Please let me know if more info I neededPublished by: njafri on January 5, 2010 13:33
Tags: Database
Similar Questions
-
SQL Query Tuning (large table)
Hi all
Ask your help for Tuning below mentioned simple query.
SELECT distinct BROKER_CODE FROM PROCESSED_TRXNS WHERE FOLIO_NO = '101302'Top query takes about 15 seconds to give the output.
Explain the plan: -.
Hash value of plan: 2775832988
-----------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
-----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 29. 609 | 38241 (1) | 00:07:39 |
| 1. UNIQUE NOSORT FATE. | 29. 609 | 38241 (1) | 00:07:39 |
|* 2 | INDEX SKIP SCAN | PROCTRAN_BRC_FN_C1 | 29. 609 | 38240 (1) | 00:07:39 |
-----------------------------------------------------------------------------------------Information of predicates (identified by the operation identity card):
---------------------------------------------------2 - access ("FOLIO_NO" = '101302')
Filter ("FOLIO_NO" = '101302')
Additional info: -.
SELECT COUNT (1) IN PROCESSED_TRXNS - 135989170Composite index on BROKER_CODE, FOLIO_NO in the table
The optimizer expects that the skip scan to take at 7:39 min - so the 15 sec are not so bad. And I'm sure that the operation is faster than a full Table Scan on PROCESSED_TRXNS. If you do not have a post adjustment index more then the skip scan might indeed be the best available strategy. I expect an index on PROCESSED_TRXNS (FOLIO_NO, BROKER_CODE) to be more effective for the query, because it should allow a range of index analysis which should read only the part of the index with the given FOLIO_NO. But create additional indexes will obviously slow down DML and could have an impact on other query execution plans (and not necessarily a positive impact).
-
With functions in the SQL query tuning
Hello
I'm trying to settle a query with functions in the select section. You wonder how to see the results of the plan to explain these features included. Will there be a qs to include when you run the explain plan command
Thank you
Hilton
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production."
AMT for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Thank you. The function is not in the where clause but in the query using some of the returned columns. I realized that using the trace gave me the plan explanation of each of the functions.
-
Oracle Database 10 g Enterprise Edition release 10.2.0.3.0 - 64bi
PL/SQL version 10.2.0.3.0 - Production
CORE Production 10.2.0.3.0
AMT for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - production
NLSRTL Version 10.2.0.3.0 - Production
I have a request involoved sweep the entire table with 5 billion lines and its execution plan indicates that it uses almost 40 tablespace temp G takes a lot of time. I am trying to tune by the biggest table based on a single partitioning column and run this query based on partitioned column at once does not work. This table is also used by other queries, I'm not sure whether paritioning of this table is wrong another query?
Thanks in advance.PL see these discussions on how to post a request for Setup:
HOW to: Validate a query of SQL statement tuning - model showing
When your query takes too long...
HTH
Srini -
How do I get recommendations sql query manually, its possible or not?
I'm new dba oracle and my company gives me sql optimize, if research on google and knowledge, addm can give recommendations of sql query
but I sql query and in addm can not give recommendations,
I then how sql query performance increase... ?
and the sql script to get the recommendations?
Thanks in advance
1. upgrade to oracle 11
2. (take the topgun)
Select / * + RESULT_CACHE * / a.empid, empname from
(select empid, empname from india_emp
where deptno <> 10 and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
Union of all the
Select empid, empname from us_emp
where deptno <> 10 and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
Union of all the
Select empid, empname from uk_emp
where deptno <> 10 and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
Union of all the
Select empid, empname from uae_emp
where deptno <> 10 and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
Union of all the
Select empid, empname from brazl_emp
where deptno <> 10 and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
Union of all the
Select empid, empname from chine_emp
where deptno <> 10 and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
Union of all the
Select empid, empname from jpn_emp
where deptno in (54,256,362,9879,24,46) and empid NOT IN (105,202,11,45,695,646,726,8465,965,56,646,689,446)
) a
order by 2;
3. run the query 3 times.
The query will be lightning fast from the 3rd time
4. read the full performance tuning guide
http://docs.Oracle.com/CD/E11882_01/server.112/e41573/TOC.htm
-
Query Tuning requirements.
Hello
I'm not as good as in sql queries and joins the digital smart writing Sql.
Think of me as a dba and task is to resolve queries wrong, what I should know basic, intermediate, advance level query tuning. also consider that the developers have only a large part of the knowledge to optimize queries.
Query tuning requires knowledge of PL/SQL? because the guys on developer close to me wrote anonymous PL/SQL blocks most of the time.
Thank you
user12187861 wrote:
Hello
I'm not as good as in sql queries and joins the digital smart writing Sql.
Think of me as a dba and task is to resolve queries wrong, what I should know basic, intermediate, advance level query tuning. also consider that the developers have only a large part of the knowledge to optimize queries.
Query tuning requires knowledge of PL/SQL? because the guys on developer close to me wrote anonymous PL/SQL blocks most of the time.
Thank you
Setup of the query can be taught on the forums. Please buy Troubleshooting Oracle Performance (Apress), CBO Fundamentals (Apress) and Oracle practice 8i(Addison Wesley) and read them with a blanket. In the meantime read to keep on trying to make efforts to make queries resolved in accordance with instructions learned in these books.
Good luck!
Aman...
-
application of SQL statement tuning
Application of SQL statement tuning
1 SQL: Code that never ends. 11 hours running, but nothing get inserted into tables
2. database version:
3.SELECT * FROM V$VERSION; BANNER Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi PL/SQL Release 10.2.0.4.0 - Production CORE 10.2.0.4.0 Production TNS for Solaris: Version 10.2.0.4.0 - Production NLSRTL Version 10.2.0.4.0 - Production
(i)
BIFSQL> SHOW PARAMETER OPTIMIZER NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ optimizer_dynamic_sampling integer 2 optimizer_features_enable string 10.2.0.4 optimizer_index_caching integer 0 optimizer_index_cost_adj integer 100 optimizer_mode string ALL_ROWS optimizer_secure_view_merging boolean TRUE SQL>
(III)SQL> SHOW PARAMETER DB_FILE_MULTI NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_multiblock_read_count integer 16 SQL>
(IV)SQL> SHOW PARAMETER DB_BLOCK_SIZE NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_block_size integer 8192 SQL>
4 calendar and Autotrace outputSQL> SHOW PARAMETER CURSOR_SHARING NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cursor_sharing string EXACT SQL>
one)
(b)SQL> SQL> SET AUTOTRACE TRACEONLY SQL> Query; 99999 rows selected. Execution Plan ---------------------------------------------------------- Plan hash value: 888060805 -------------------------------------------------------------------------------- ------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- ------ | 0 | SELECT STATEMENT | | 99999 | 171M| 6452 (1)| 00:0 1:18 | |* 1 | COUNT STOPKEY | | | | | | | 2 | TABLE ACCESS FULL| STGING| 99999 | 171M| 6452 (1)| 00:0 1:18 | -------------------------------------------------------------------------------- ------ Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter(ROWNUM<100000) Statistics ---------------------------------------------------------- 8 recursive calls 0 db block gets 33379 consistent gets 24108 physical reads 0 redo size 177773283 bytes sent via SQL*Net to client 46901 bytes received via SQL*Net from client 6668 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 99999 rows processed
6. explain Plan outputSQL> SET AUTOTRACE TRACEONLY EXPLAIN rem Could't do SET AUTOTRACE TRACEONLY as query takes a long time. SQL> Query; Execution Plan ---------------------------------------------------------- Plan hash value: 696991379 -------------------------------------------------------------------------------- ------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc | Cost (%CPU)| Time | -------------------------------------------------------------------------------- ------------------------- | 0 | SELECT STATEMENT | | 99999 | 171M| | 77733 (1)| 00:15:33 | | 1 | HASH UNIQUE | | 99999 | 171M| 390M | 77733 (1)| 00:15:33 | |* 2 | CONNECT BY WITHOUT FILTERING| | | | | | | | 3 | VIEW | | 99999 | 171M| | 40120 (1)| 00:08:02 | |* 4 | COUNT STOPKEY | | | | | | | | 5 | TABLE ACCESS FULL | STG_OLD_RUBRIC1 | 621K| 1066M| | 40120 (1)| 00:08:02 | -------------------------------------------------------------------------------- ------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter(LEVEL<=(LENGTH("STRING")-LENGTH(REPLACE("STRING",' Criterion:')))/10 ) 4 - filter(ROWNUM<100000) SQL>
7. from TKPROF outputSQL> ed Wrote file afiedt.buf 1 EXPLAIN PLAN SET STATEMENT_ID = 'A' FOR 2 QUERY; 3 / Explained. SQL> SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Plan hash value: 696991379 -------------------------------------------------------------------------------- ------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc | Cost (%CPU)| Time | -------------------------------------------------------------------------------- ------------------------- PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 99999 | 171M| | 77733 (1)| 00:15:33 | | 1 | HASH UNIQUE | | 99999 | 171M| 390M | 77733 (1)| 00:15:33 | |* 2 | CONNECT BY WITHOUT FILTERING| | | | | | | | 3 | VIEW | | 99999 | 171M| | 40120 (1)| 00:08:02 | PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- |* 4 | COUNT STOPKEY | | | | | | | | 5 | TABLE ACCESS FULL | STGING| 621K| 1066M| | 40120 (1)| 00:08:02 | -------------------------------------------------------------------------------- ------------------------- PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter(LEVEL<=(LENGTH("STRING")-LENGTH(REPLACE("STRING",' Criterion:')))/10 ) 4 - filter(ROWNUM<100000) 19 rows selected. SQL>
Any advice. Why the request is not able to generate a trace file and take so long?SQL> alter session set timed_statistics = TRUE; Session altered. SQL> alter session set sql_trace = TRUE; Session altered. SQL> query; rem it is still running, no idea what is going on.
Let me know, if needed further information.
Thank you.Something like that...?
WITH T AS (SELECT 'Criterion: Crit1.
Proficient (points 2): Crit1 text.Criterion: Crit2.
Basic (points 1): Crit2 text.Criterion: Crit3.
Proficient (points 2): Crit3 text.Criterion: Crit4.
Basic (points 1): Crit4 text.Criterion: Crit5.
Proficient (points 2): Crit5 text.
Proficient (points 2): Crit5 text.' latest_comment FROM DUAL union all SELECT 'Criterion: Crit1.
Proficient (points 2): Crit1 text.Criterion: Crit2.
Basic (points 1): Crit2 text.Criterion: Crit3.
Proficient (points 2): Crit3 text.Criterion: Crit4.
Basic (points 1): Crit4 text.Criterion: Crit5.
Proficient (points 2): Crit5 text.
Proficient (points 2): Crit5 text.' latest_comment FROM DUAL union all SELECT 'Criterion: Crit1.
Proficient (points 2): Crit1 text.Criterion: Crit2.
Basic (points 1): Crit2 text.Criterion: Crit3.
Proficient (points 2): Crit3 text.Criterion: Crit4.
Basic (points 1): Crit4 text.Criterion: Crit5.
Proficient (points 2): Crit5 text.
Proficient (points 2): Crit5 text.' latest_comment FROM DUAL ) SELECT SUBSTR(REGEXP_SUBSTR(latest_comment,'Criterion:[^<]+', 1, n.column_value), 20) column1, SUBSTR(REGEXP_SUBSTR(latest_comment,'points [^\)]+', 1, n.column_value), 8) column2, SUBSTR(REGEXP_SUBSTR(latest_comment,'\):[^<]+', 1, n.column_value), 3) column3, SUBSTR(REGEXP_SUBSTR(latest_comment,'blockquote>[^<]+', 1, n.column_value), 12) column4, SUBSTR(latest_comment, INSTR(latest_comment, '>', -1) + 1) column5 ,n.column_value FROM t,table(cast(multiset(select level from dual CONNECT BY LEVEL <= (LENGTH(latest_comment) - LENGTH(REPLACE(latest_comment, 'Criterion:')))/10) as sys.OdciNumberList)) n ;Kind regards
Bob -
Please answer for the query tuning
Hi, I am a beginner in oracle dba, I need to know if I have studied little query tuning ORACLE.
I want to know if I have the following query and its plan so how it can be tuned:
QUERY:
AND his plan is:SELECT z.emplid ,h.first_name || ' ' || h.last_name ,z.grade ,z.DEPTID ,z.LOCATION FROM sysadm.ps_lnt_latestbu_vw z, sysadm.ps_personal_data h WHERE z.empl_status ='A' --index access AND z.emplid = h.emplid --join and z.emplid not in (select g.emplid from sysadm.ps_lnt_asn_skl_tbl g) --join and z.Business_unit= ( select l.lnt_subunit from sysadm.ps_position_data l where l.position_nbr in ( select b.position_nbr from sysadm.ps_job b,sysadm.psoprdefn y where b.effdt=( select max(g.effdt) from sysadm.ps_job g where g.emplid=b.emplid --join costs high and g.effdt<=SYSDATE) --filter/index and b.effseq= (select max(h.effseq) from sysadm.ps_job h where h.emplid=b.emplid --join costs high and h.effdt=b.effdt) --join costs high and b.empl_rcd=0 --filter/index access and y.EMPLID=b.EMPLID --join and y.OPRID='1112' -- filter/index access ) ) order by z.emplid /
My thoughts for this is:Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=1 Bytes=64) 1 0 SORT (ORDER BY) (Cost=6 Card=1 Bytes=64) 2 1 NESTED LOOPS (ANTI) (Cost=4 Card=1 Bytes=64) 3 2 NESTED LOOPS (Cost=3 Card=1 Bytes=56) 4 3 VIEW OF 'PS_LNT_LATESTBU_VW' (Cost=2 Card=1 Bytes=31) 5 4 UNION-ALL 6 5 CONCATENATION 7 6 TABLE ACCESS (BY INDEX ROWID) OF 'PS_POSITION_DATA' (Cost=5 Card=90 Bytes=1890) 8 7 NESTED LOOPS 9 8 NESTED LOOPS (Cost=275 Card=1 Bytes=90) 10 9 NESTED LOOPS (Cost=275 Card=1 Bytes=82) 11 10 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=50) 12 11 INDEX (RANGE SCAN) OF 'PS2JOB' (NON-UNIQUE) (Cost=2 Card=1) 13 12 SORT (AGGREGATE) 14 13 FIRST ROW (Cost=3 Card=1 Bytes=19) 15 14 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 16 12 SORT (AGGREGATE) 17 16 FIRST ROW (Cost=3 Card=1 Bytes=22) 18 17 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 19 10 INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT'(UNIQUE) 20 9 INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE) 21 8 INDEX (RANGE SCAN) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=5 Card=90) 22 6 FILTER 23 22 NESTED LOOPS (Cost=275 Card=1 Bytes=90) 24 23 NESTED LOOPS (Cost=275 Card=1 Bytes=82) 25 24 NESTED LOOPS (Cost=275 Card=1 Bytes=71) 26 25 INDEX (FAST FULL SCAN) OF 'PS8POSITION_DATA' (NON-UNIQUE) (Cost=5 Card=90 Bytes=1890) 27 25 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=50) 28 27 INDEX (RANGE SCAN) OF 'PS2JOB' (NON-UNIQUE) (Cost=2 Card=1) 29 28 SORT (AGGREGATE) 30 29 FIRST ROW (Cost=3 Card=1 Bytes=22) 31 30 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 32 28 SORT (AGGREGATE) 33 32 FIRST ROW (Cost=3 Card=1 Bytes=19) 34 33 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 35 24 INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT' (UNIQUE) 36 23 INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA'(UNIQUE) 37 22 SORT (AGGREGATE) 38 37 FIRST ROW (Cost=2 Card=1 Bytes=17) 39 38 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=2 Card=9000) 40 5 FILTER 41 40 NESTED LOOPS (Cost=751 Card=1 Bytes=191) 42 41 NESTED LOOPS (OUTER) (Cost=750 Card=1 Bytes=167) 43 42 NESTED LOOPS (OUTER) (Cost=749 Card=1 Bytes=143) 44 43 NESTED LOOPS (Cost=748 Card=1 Bytes=134) 45 44 NESTED LOOPS (Cost=748 Card=1 Bytes=123) 46 45 NESTED LOOPS (Cost=748 Card=1 Bytes=119) 47 46 NESTED LOOPS (Cost=747 Card=1 Bytes=98) 48 47 NESTED LOOPS (Cost=744 Card=1 Bytes=62) 49 48 NESTED LOOPS (Cost=744 Card=1Bytes=54) 50 49 VIEW OF 'PS_LNTPRJOBSYSJRVW'(Cost=741 Card=1 Bytes=9) 51 50 FILTER 52 51 NESTED LOOPS (OUTER) (Cost=735 Card=1 Bytes=68) 53 52 NESTED LOOPS (Cost=734Card=1 Bytes=51) 54 53 NESTED LOOPS (Cost=734 Card=1 Bytes=43) 55 54 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=734 Card=1 Bytes=32) 56 55 INDEX (RANGE SCAN) OF 'PSCJOB' (NON-UNIQUE) (Cost=206 Card=1013) 57 54 INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT' (UNIQUE) 58 53 INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE) 59 52 INDEX (RANGE SCAN) OF'PS_POSITION_DATA' (UNIQUE) (Cost=1 Card=1 Bytes=17) 60 51 SORT (AGGREGATE) 61 60 FIRST ROW (Cost=3 Card=1 Bytes=19) 62 61 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 63 51 SORT (AGGREGATE) 64 63 FIRST ROW (Cost=3 Card=1 Bytes=22) 65 64 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 66 51 SORT (AGGREGATE) 67 66 FIRST ROW (Cost=2 Card=1 Bytes=17) 68 67 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=2 Card=9000) 69 49 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=45) 70 69 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 71 70 SORT (AGGREGATE) 72 71 INDEX (RANGE SCAN) OF'PSAJOB' (NON-UNIQUE) (Cost=3 Card=1 Bytes=19) 73 72 SORT (AGGREGATE) 74 73 FIRST ROW (Cost=3Card=8 Bytes=88) 75 74 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=25963) 76 70 SORT (AGGREGATE) 77 76 FIRST ROW (Cost=3 Card=8 Bytes=88) 78 77 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=25963) 79 48 INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE) 80 47 TABLE ACCESS (BY INDEX ROWID) OF'PS_JOB' (Cost=3 Card=1 Bytes=36) 81 80 INDEX (RANGE SCAN) OF 'PSAJOB'(NON-UNIQUE) (Cost=2 Card=1) 82 81 SORT (AGGREGATE) 83 82 FIRST ROW (Cost=3 Card=1 Bytes=19) 84 83 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 85 81 SORT (AGGREGATE) 86 85 FIRST ROW (Cost=3 Card=1 Bytes=22) 87 86 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700) 88 46 INDEX (RANGE SCAN) OF 'PS8POSITION_DATA' (NON-UNIQUE) (Cost=1 Card=1 Bytes=21) 89 45 INDEX (UNIQUE SCAN) OF 'PS_BUS_UNIT_TBL_HR' (UNIQUE) 90 44 INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT'(UNIQUE) 91 43 INDEX (RANGE SCAN) OF 'PS_POSITION_DATA'(UNIQUE) (Cost=1 Card=1 Bytes=9) 92 42 INDEX (FULL SCAN) OF 'PS0LOCATION_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=24) 93 41 INDEX (RANGE SCAN) OF 'PS0LOCATION_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=24) 94 40 SORT (AGGREGATE) 95 94 FIRST ROW (Cost=2 Card=1 Bytes=17) 96 95 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=2 Card=9000) 97 4 TABLE ACCESS (BY INDEX ROWID) OF 'PS_POSITION_DATA' (Cost=2 Card=1 Bytes=13) 98 97 NESTED LOOPS (Cost=9 Card=1 Bytes=19) 99 98 VIEW OF 'VW_NSO_1' (Cost=5 Card=1 Bytes=6) 100 99 SORT (UNIQUE) 101 100 NESTED LOOPS (Cost=5 Card=1 Bytes=44) 102 101 TABLE ACCESS (BY INDEX ROWID) OF 'PSOPRDEFN' (Cost=2 Card=1 Bytes=14) 103 102 INDEX (UNIQUE SCAN) OF 'PS_PSOPRDEFN'(UNIQUE) (Cost=1 Card=1) 104 101 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=30) 105 104 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 106 105 SORT (AGGREGATE) 107 106 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=8 Bytes=128) 108 105 SORT (AGGREGATE) 109 108 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=1 Bytes=19) 110 98 INDEX (RANGE SCAN) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=1 Card=1) 111 3 TABLE ACCESS (BY INDEX ROWID) OF 'PS_PERSONAL_DATA'(Cost=1 Card=1 Bytes=25) 112 111 INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE) 113 2 INDEX (RANGE SCAN) OF 'PS_LNT_ASN_SKL_TBL' (UNIQUE) (Cost=1 Card=10076 Bytes=80608) } Statistics ---------------------------------------------------------- 70 recursive calls 0 db block gets 1186931 consistent gets 5660 physical reads 60 redo size 462 bytes sent via SQL*Net to client 373 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 2 sorts (memory) 0 sorts (disk) 0 rows processed
1 NLJ high cost - rewrite a subquery internal
2. sort is performed for each join for max function every time so try so use use sort merge hint
3 h alias has been referenced twice for the name of the table.
PLEASE ME TELL IF I AM ORACLE DBA.
Thanks in advance.
Published by: user2060331 on March 25, 2010 09:17
Published by: user2060331 on March 25, 2010 09:21
Published by: user2060331 on March 25, 2010 09:32
Published by: user2060331 on March 25, 2010 09:47Seriously, peoplel aren't going to be able to read your message in this format on the forum.
Use the button Edit to edit your post and make sure your code/explain plants etc has {noformat}
{noformat} tags both before and after it so that the formatting is retained and we can read it.
-
Find the sql query in statspack report
Salvation;
I have 11.5.10.2 and db version 9iR2... I took a statspack report, and I should find a sql query... But admin, is kill session and I can't see complite sorted SQL query by gets for DB...
so the question is find this query which is kiiled by admin?
Thank youHello
Its bad news to can not find this sql... So normally it istn killed by admin, I could find it from stats$ sql_summary or v$ sql_text?
It is possible.
Note: 153507.1 - Applications Oracle StatsPack
https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=153507.1And another question... If I have a sql printing is eating my cpu or my server resource, how do I find this sql? Under what title I can find in the statspack report
Refer to:
Note: 232443.1 - how to identify the resource intensive SQL for Tuning
https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=232443.1Kind regards
Hussein -
eBooks on SQL query optimization
Hello.
can someone assign me all the technical links for ebooks on tuning SQL query to 10g or 11g.
Tuning SQL queries, it's something I want to build my expertise...
There may be many consultants as the query SQL, Access Advisor Advisor and so on... but nothing of such adjustment your queries manually for maximum optimization.
Kindly help me in this!Check Oracle docs http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/toc.htm
But really, you should also check:
http://www.asktom.Oracle.com
http://tkyte.blogspot.com
AND all the other blogs he does (like Jonathan Lewis site and blog) you will find many interesting articles there, the 'real world', regarding performance and optimization.
Published by: hoek on March 24, 2009 10:40
-
Œuvres SQL query to MS SQL Server 2008, but not when you use the database kit
I have this SQL query:
DECLARE TABLE (@DataTypeTable)
Name varchar (128).
TypeID INT)-Add comma delimeted type data in the temporary table names
INSERT INTO @DataTypeTable (name)
SELECT * from WhatWeShouldDoRead.func_Split (@DataTypeTrimmed, ',')SELECT the name OF @DataTypeTable
That takes a comma delimited by the string and returns the string as a table. It works correctly in Microsoft SQL Server Management Studio. When I run this as a stored procedure I return nothing. There are no errors, SQL or otherwise. I checked that I am connected to the correct database and the stored procedure is responsible without changing any error chain which is reported of this stored procedure (that code is not shown in the example above). Has anyone seen this problem before, or have experience with SQL/Labview interfaces to tell me what I am doing wrong?
Thanks in advance.
-
HI HI... I'm a student doing a project related to labview. My task is to create a vi, type a user name and password to continue the whole VI.
As I am a newbie to SQL query language, can anyone help me this?... This isn't like the VI with password lock
There is a connection of the user called button in my main façade... u by clicking on it, a pop-up window will come out asking you a user name and a password. If the user name and the password is correct, then you can proceed. The problem is that I'm stuck with database...
Help me pls!with respect,
Ray
Hello
You have two cases:
(1) connect to the database with string (link a string of connection information), and then type something like this:
Driver is SQL Native Client;. Server = IP. Add.re.SS; UID = username; PW = *** ; Database = MyDatabase (depends on your database)(2) use a UDL file (you can configure it to connect to your database, with specific format). Remember that the connection is successful with test button.
There is a UDL file that you can edit here: C:\Program NIUninstaller Instruments\LabVIEW 2010\examples\database\Labview.udl
Edit: The connection dropped, you can set the path to an mdb file, and I think you can give the path of your accdb file.
Kind regards
-
I am trying to execute the following SQl query, SELECT * failure WHERE ID = '123 ' AND RepairAction =' '; using the DB tools run Query.vi. This query never find record in my database. My database contains a record where the registered ID contains the value '123' and the RepairAction field is an empty string. If I remove the declaration 'AND RepairAction' ';' my query text, the record is found. I think my problem is that I do not use the correct syntax to describe and an empty string. I tried the following: "," ",""," "and NULL as empty and none of these work string arguments.
I was hoping someone might be able to tell me what the correct syntax is an empty string or if there is another approach that I take.
Thanks in advance for your help,
Jim
Jim,
Just to be sure, have you used 'is' instead of '=' in this command?
This makes all the difference in this command.
Cerati
-
Support of SQL query: what tasks are Sunday from 07:00 - 12:00
Hello tide Admins.
I need to do a SQL query that can give me a list of jobs that are running on a given (Sunday) day from 07:00 - 12:00. Our environment is not a maintenance window. Therefore, whenever there is application of patches or upgrades, it causes more work and risk of failure of the tide tasks. By moving jobs over the period from 07:00 - 12:00 Sunday, patch can be completed without disrupting the calendar.
Im not the best at the SQL script and can not get my script to work. any help would be great. Here's what I have so far. I get the error ' could not find identifier multi-player jobmst.jobmst_name. IM using Tidal 6.0.3 with SQL for DB Admeral table.
SELECT dbo.jobdtl.jobdtl_id, dbo.jobmst.jobmst_prntname, dbo.jobmst.jobmst_name
FROM dbo.jobdtl INNER JOIN
dbo.jobmst ON dbo.jobdtl.jobdtl_id = dbo.jobmst.jobdtl_id
WHERE (dbo.jobdtl.jobdtl_fromdt > 14 September 2016 06:00 ') AND (dbo.jobdtl.jobdtl_fromdt< '09/11/2016="" 012:00:00="">
GROUP OF dbo.jobdtl.jobdtl_id, dbo.jobmst.jobmst_prntname, dbo.jobmst.jobmst_name
Hi Jeff
The time window from the jobdtl returns only jobs that have an early start time and windows of time from beginning to the end, so there may be some tasks which are not time bound but have dependencies on other jobs, variables, etc.
Here are the 2 SQL queries against the table jobrun and jobmst:
-The list of jobs that took place last Sunday between 07:00 and 12:00
SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.jobrun_time FROM jobrun
JOIN jobmst on jobrun.jobmst_id = jobmst.jobmst_id
WHERE jobrun.jobrun_time > = 9/11/2016 07:00 ' and jobrun.jobrun_time<= '9/11/2016="" 12:00="">=>
ORDER BY jobrun.jobrun_time-For a list of jobs that are scheduled to run on Sunday to come between 07:00 and 12:00
SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.jobrun_esttime FROM jobrun
JOIN jobmst on jobrun.jobmst_id = jobmst.jobmst_id
WHERE jobrun.jobrun_esttime > = 9/18/2016 07:00 ' and jobrun.jobrun_esttime<= '9/18/2016="" 12:00="">=>
ORDER BY jobrun.jobrun_esttimeARO
The Derrick
-
How to get the value of a column in sql query?
Hi, anyone knows how to get the value of a column in sql query?
Here is my code, the value must be 1350079224397 in my PB, but I get 0
QString query ("SELECT version FROM db_version");
QVariant result = sda.execute (query);
QVariantMap versionMap = result.toList () such () .toMap ();
If (! versionMap.IsEmpty ())
{
qDebug()<"Version: "="">"Version:><>
}OK, I have the solution
QString query ("SELECT version as version FROM db_version");
Maybe you are looking for
-
60% (plugged in, load) but does not load
I have a Lenovo y510p, and it does not load 60%. It is said he is in charge, but it doesn't. My battery is 'maximum autonomy' in energy management. When I change for the health of the battery "optimized" it says plugged in, does not support. I search
-
I have no sound on the computer after the installation of Windows XP.
After the download of Windows XP in a torrent of the 'P2P' file on a disk. Then I installed it. But now, there is no audio device. Anyone know what I can do? Original title: no sound after installation of windows XP
-
Keep losing Internet connection on the new laptop HP
Hi, I recently got a laptop HP pavilion, but the internet connection keeps ending. I'm family premium Vista running on it. Have domestic also work 6,000 inspiron dell wireless on the same network and it never disconnects. Totally reliable so I think
-
I searched the Web sites to find the download of WOW64. I failed in my research and would like to know if there is a link that will allow me to download a copy of WOW64? Thank you.
-
How can I search in Windows 7 for a colon? Given that search filters to specify the properties that I cannot hide it colon. Search for strings inside documents containing a ': '.Greetings