Feature of the parallel execution of SQL query
Hello guys,.
I installed a 11 GR 2 Oracle RAC (11.2.0.3) database, but I see the use of the feature of running parallel SQL queries, but I never used that.
I would like to know if this feature is enabled by default on CCR environments and if it does not require me to pay for Enterprise Edition.
NAME DETECTED_USAGES FIRST_USA LAST_USAG CURRE
---------------------------------------------------------------- --------------- ----- --------- ---------
Checking Options 1 TRUE 9 October 15 October 9, 15
BMG Auto setting 1 TRUE 9 October 15 October 9, 15
Memory of the execution of SQL auto 1 TRUE 9 October 15 October 9, 15
Automatic management of the space Segment (System) 1 TRUE 9 October 15 October 9, 15
Automatic Storage Management 1 TRUE 9 October 15 October 9, 15
Management of the Undo Automatic 1 TRUE 9 October 15 October 9, 15
Character set 1 TRUE 9 October 15 October 9, 15
Deferred Segment creation 1 TRUE 9 October 15 October 9, 15
Locally managed tablespaces (System) 1 TRUE 9 October 15 October 9, 15
Locally managed tablespaces (user) 1 TRUE 9 October 15 October 9, 15
Logfile multiplexing 1 TRUE 9 October 15 October 9, 15
Oracle Java Virtual Machine (System) 1 TRUE 9 October 15 October 9, 15
Oracle utility of metadata API 1 TRUE 9 October 15 October 9, 15
1 SQL query in parallel TRUE 9 October 15 October 9, 15
Partitioning (System) 1 TRUE 9 October 15 October 9, 15
Real Application Clusters (RAC) 1 TRUE 9 October 15 October 9, 15
Recovery zone 1 TRUE 9 October 15 October 9, 15
SECUREFICHIERS (System) 1 TRUE 9 October 15 October 9, 15
SECUREFICHIERS (user) 1 TRUE 9 October 15 October 9, 15
The parameter server file 1 TRUE 9 October 15 October 9, 15
Thanks in advance,
Franky
You are not, but Oracle is, since you are using RAC. Oracle relies on execution in parallel against the gv$ views so even if you can't use it in SE way common Oracle can when it comes to query against one of the points of view gv$. That's why DBA_FEATURE_USAGE_STATISTICS reports that you see.
David Fitzjarrell
Tags: Database
Similar Questions
-
Need help to reduce the cost of my sql Query below 100 to optimize.
Can you please suggest how to reduce the COST of my SQL query? Is it possible to get the < 100 COST?
My goal:
------------------------
To recover the data of length (a column is in normalised_event: table) corresponding to each type of call (which is to extract the column rc.abbreviation in reference_code: table) in a given range of dates. So I wrote the following as SQL below:
------------------------------------------------------------------------------------------------------------------
Select nvl (sum (round(ne.duration/60,3)), 0), rc.abbreviation
Since the rc reference_code, normalised_event not
where to_char (rc.reference_code) = ne.full_path
and rc.reference_type_id = 505002 AND
trunc (don't. CHARGE_START_DATE) between trunc (to_date (January 1, 2008 "," dd-mm-yyyy hh24:mi:ss'))))
and trunc (to_date (January 1, 2009 "," dd-mm-yyyy hh24:mi:ss'))))
Rc.abbreviation group
-----------------------------------------------------------------------------------------------------------------
IAM using Toad Software which is taken in charge by oracle 9i.
Explain the plan above query is:
explain plan
Set statement_id = "mp01" for
Select nvl (sum (round(ne.duration/60,3)), 0), rc.abbreviation
Since the rc reference_code, normalised_event not
where to_char (rc.reference_code) = ne.full_path
and rc.reference_type_id = 505002 AND
trunc (don't. CHARGE_START_DATE) between trunc (to_date (January 1, 2008 "," dd-mm-yyyy hh24:mi:ss'))))
and trunc (to_date (January 1, 2009 "," dd-mm-yyyy hh24:mi:ss'))))
Rc.abbreviation group
Select LPad (' ', 2 *(Level-1)). Level | '.' || NVL (position 0). ' ' ||
Operation | ' ' || Options of | ' ' || Object_name | ' ' ||
Object_type | ' ' || Decode (id, 0, Statement_Id |) "Cost = ' | Position)
"Query plan.
From Plan_Table
Start with id = 0 and Statement_Id = 'mp01 ".
Connect Id Parent_Id = prior
And Statement_Id = 'mp01 ";
---------------------------Query Plan explained is----------------------------------------------------------
1.555 INSTRUCTION SELECT mp01 cost = 555
2.1 TYPE GROUP
3.1 FILTER
4.1 HASH JOIN
5.1 TABLE ACCESS BY INDEX ROWID REFERENCE_CODE
6.1 INDEX RANGE SCAN NON-UNIQUE I_REFERENCE_CODE_REF_TYPE
5.2 PARTITION RANGE ALL THE
6.1 TABLE ACCESS FULL NORMALISED_EVENT
-Automatic tracking of the SQl query is:.
recursive calls - 0
DB block gets - 0
compatible gets - 174
physical reads - 0
size - 104
Parse count (hard) - 0
Parse count (chess) - 0
run the County - 2
bytes sent via SQL * Net to dblink - 0
bytes received via SQL * Net from dblink - 0I was wrong. Once again, this shows how it is dangerous to assume (I assumed that FBI was new in 10g because it is when I used them), and the power of the community to ensure that accurate information is provided.
John
-
Latch free waits with the parallel execution
Hello
I have a table in a DB 11.1.0.7 with millions of lines I need of aggregation after a search on each line operation. The operation consisted in the determination of a small, constant lookup table the highest value that is less than a column. So I have this array of so-called transation, with some traits of hundreds:
and a small function that gets the value of your choice (after an additional mapping):CREATE TABLE ref_trad ( entry varchar2(50) PRIMARY KEY, id integer NOT NULL );
Now when I try to aggregate the table using parallelism, I get a lot of waits 'latch free '. With 4 parallel sessions for example, looking at the graphs in 'EM, I get about 2.5 sessions on CPU and 1.5 on waiting 'latch free '. I have the impression of reading around that the wait could be due to a hot block in index table of ref_trad or something similar. I tried several things, such as the use of the tables of index_organized or the partitioning of the tiny table_reference, hoping to get more parallelism, without spectacular results. So my questions to those who know it are the following:CREATE OR REPLACE FUNCTION translate_num(num IN varchar2) RETURN integer RESULT_CACHE RELIES_ON (ref_block) AS nm_id integer; BEGIN SELECT m.number_id INTO nm_id FROM ref_number_map m INNER JOIN ref_trad t ON (m.block_id = t.id) WHERE t.entry = (SELECT max(entry) FROM ref_trad WHERE entry <= num); RETURN nm_id; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 0; END;
-How to determine with precision the cause for waiting latch_free events? (e.g., the hot block, the piece of PL/SQL code, etc.)
Is there some sort of mode of implementation of a standard and efficient lookup table? (I've heard on the loading table in a PL/SQL table, would it be useful? No matter what pointer on how to do this? )
-Why should there be contention in the first place in this case, because all the search logic is read-only?
Thanks for all your help!
ChrisHi Chris,
-How to determine with precision the cause for waiting latch_free events? (e.g., the hot block, the piece of PL/SQL code, etc.)
Trace your SQL, search slaves PX trace files, look for the settings for event wait - and you here. Another option is to use one of the scripts of Tanel Poder - waitprof.
Is there some sort of mode of implementation of a standard and efficient lookup table? (I've heard on the loading table in a PL/SQL table, would it be useful? No matter what pointer on how to do this? )
Not sure about a 'standard', but it's a good thing at least do a table index.
-Why should there be contention in the first place in this case, because all the search logic is read-only?
Since Oracle should have the means of access of sinchronizing to a shared structures - LMS - since they are used simultaneously by several processes.
A good thing to make your faster SQL is to get rid of PL/SQL - it's not a good thing to use SQL [even with RESULT_CACHE | http://www.pythian.com/news/598/oracle-11g-query-result-cache-rc-latches]. Write your logic in a single pure SQL, it might be very beneficial even without special setting.
-
There is a configuration option that allows the parallel execution of sub vi?
I'm trying to run a vi in teststand has two parallel execution paths. A path under vi implements the trigger and wait for data from a module scope, while in the other lane, I'm starting a power supply. The power waits until the scope is armed and runs.
It works as a standalone vi. When I try to run this vi in teststand he works the first vi scope and then runs the power supply. Of course vi opportunities get to expiration and outputs and data are not met.
I tried a number of methods of synchronization, and although they seem to work standalone, as soon as I try them in Testsatnd I have this problem.
I am new to teststand and I was wondering if there is some configuration config I missed which allows a vi like this to run as he's independent.
I have a number of simple screws that run as planned, but this one left me speechless.
I had to split these screws but would really prefer to have them in the same vi.
(The latest versions of teststand and Labview running)
Henry
hkroker,
It is a known problem. Please refer to the following KB to help solve your problem.
- Parallel blocks run sequentially why does my LabVIEW VI when it is called from TestStand?
Concerning
Anand jegou
National Instruments
-
How the importance of the "advice" in a SQL query when optimizing the query?
I'm tuning an application (Documentum) and the query contains advice. See the request below for example... a very simple example to show the point; actual queries are one more page of time with several joins.
During approval of the application (possibly adding new indexes), how is it important to grant the request WITH ADVICE, or can I get advice from the setting process? It's the FORCE_ORDER indicator.
Select / * + SORTED * / object_name dm_sysobject_s;Welcome to the forum!
Whenever you post, provide your Oracle 4-digit.
>
I'm tuning an application (Documentum) and the query contains advice. See the request below for example... a very simple example to show the point; actual queries are one more page of time with several joins.During approval of the application (possibly adding new indexes), how is it important to grant the request WITH ADVICE, or can I get advice from the setting process? It's the FORCE_ORDER indicator.
Select / * + SORTED * / object_name dm_sysobject_s;
>
The overall goal is to have NO clues in the production code.Advice would normally be to help determine why Oracle has not chosen the best plan for the work to do. Once you know which plan is best seeks the Oracle to use this plan without the need to add a hint to do.
Tips are sometimes necessary (e.g. the DRIVING_SITE hint) and for batch processes that operate on independent tables (intermediate tables) APPEND it hint is used oftne.
Who put the tip in the Documentum query? If she was not part of your own people to be careful if you decide to remove it.
When you have a query that is already at work that has a hint of make you that get the current execution plan before you make changes to the query. You will need this plan after that any withdrawal "tuning" or suspicion that do you to make sure that the plan has not changed.
-
The search syntax of SQL query against the data type varchar2 preserving valid data.
Have a data model that we are not allowed to change and the column in question is a varchar2 (20). The column has at this stage no foreign key to the list of valid values. So, until we can get those who control the data model in order to make the adjustments we need for a SQL query that root out us bad data on the hours fixed.
Is what we expect to be good data below:
-Whole number, without floating point
-Length of 5 or less (greater than zero but less than 99999)
-Text "No_RP" can exist.
Request demo below works most of the time with the exception of 'or Column1 is null' is not contagious in the null record. I tried to change the logical terms around, but did not understand the correct layout still provide it. So help would be greatly appreciated it someone could put me straight on how to properly register a null value in the recordset that has been selected with other types of error for end users to correct their mistakes. Another thing, I suppose there could be a better approach syntactically to a call find all offender characters such as *, &, (and so on.)
WITH Sample_Data AS (SELECT '0' collar OF DOUBLE UNION ALL)
SELECT "2" collar OF DOUBLE UNION ALL
SELECT "99999" col OF DOUBLE UNION ALL
SELECT "100000" col OF DOUBLE UNION ALL
SELECT '1 a' collar OF DOUBLE UNION ALL
SELECT the "ABCD" OF DOUBLE UNION ALL pass
SELECT 'A1' collar OF DOUBLE UNION ALL
SELECT ' *' collar OF DOUBLE UNION ALL
SELECT "/" pass OF DOUBLE UNION ALL
SELECT '-' col OF DOUBLE UNION ALL
SELECT ' ' collar OF DOUBLE UNION ALL
SELECT "pass OF DOUBLE UNION ALL
4. SELECT 5 6' collar OF DOUBLE UNION ALL
SELECT "24.5" collar OF DOUBLE UNION ALL
SELECT '-3' collar OF DOUBLE UNION ALL.
SELECT 'A' collar OF DOUBLE UNION ALL
SELECT 'F' OF DOUBLE UNION ALL cervical
SELECT the 'Z' OF DOUBLE UNION ALL pass
SELECT the pass 'Bye' FROM DUAL UNION ALL
SELECT the "Hello World" OF DOUBLE UNION ALL pass
SELECT "=" col OF DOUBLE UNION ALL
SELECT "+" col OF DOUBLE UNION ALL
SELECT '_' pass OF DOUBLE UNION ALL
SELECT '-' col OF DOUBLE UNION ALL
SELECT ' (' col OF DOUBLE UNION ALL)
SELECT ')' collar OF DOUBLE UNION ALL
SELECT '&' collar OF DOUBLE UNION ALL
SELECT ' ^' collar OF DOUBLE UNION ALL
SELECT '%' collar OF DOUBLE UNION ALL
SELECT the pass of "$" OF DOUBLE UNION ALL
SELECT the pass ' # ' TO DOUBLE UNION ALL
SELECT ' @' collar OF DOUBLE UNION ALL
SELECT '!' collar OF DOUBLE UNION ALL
SELECT ' ~' collar OF DOUBLE UNION ALL
SELECT "' collar OF DOUBLE UNION ALL
SELECT '.' pass FROM DUAL
)
SELECT col from Sample_data
WHERE (translate (col, '_0123456789', '_') is not null
or length (col) > 5
col = 0 or
or col is null)
and (upper (col) <>'NO_RP');
One more thing, I also took the approach of the regular expression, but he could not understand. If anyone knows how to do with this approach, I would also appreciate learning this method as well. Below is a close because I had. Impossible to get a range to work as "between 0 and 100000", guessing because of the comparison of varchar2 and # even attempted using to_char and to_number.
Select to_number (column1) from the testsql where REGEXP_LIKE (column1, ' ^ [[: digit:]] + $') ORDER BY to_number (column1) CSA;
Thanks in advance for anyone to help.
NickHello
Thanks for posting the sample data in a useable form.
It would be useful that you also posted the accurate results you wanted from this data. You want the same results as those produced by the query you posted, except that nulls should be included? If so:SELECT col FROM sample_data WHERE CASE WHEN UPPER (col) = 'NO_RP' THEN 1 WHEN col IS NULL THEN -1 WHEN LTRIM (col, '0123456789') IS NOT NULL THEN -2 WHEN LENGTH (col) > 5 THEN -3 ELSE TO_NUMBER (col) END NOT BETWEEN 1 AND 99999 ;
The requirement that pass! = 0 gives that much more difficult. You could test easily for an integer from 1 to 5 digits, but then you must have a separate condition to make sure that the chain was not '0', '00', '000', ' 0000 'or ' 00000'.
(Unlike Solomon, I guess that do not want to choose no-0 numbers starting by 0, such as ' 007 'or ' 02138'.)Using regular expressions, you may lose a few keystrokes, but you also lose a lot of clarity:
SELECT col FROM sample_data WHERE REGEXP_LIKE ( col , '^0{1,5}$' ) OR NOT REGEXP_LIKE ( NVL ( UPPER (col) , 'BAD' ) , '^(([1-9][0-9]{0,4})|NO_RP)$' ) ;
Published by: Frank Kulash, December 13, 2010 21:50
Published by: Frank Kulash, December 13, 2010 22:11
Added regular expression solution -
Hello
You can see why I get this error message for my SQL query?
Thanks in advance.WITH SKU_DATA AS ( SELECT /*+ MATERIALIZE */ DISTINCT FROM_LOC_ID, SKU_ID, DESCRIPTION, UPDATE_QTY, ORDER_ID, CONSIGNMENT, WEIGHT, PALLET_ID, CASE WHEN Upd_Qty_Ratio < 1 THEN TO_CHAR(UPDATE_QTY) || 'U' WHEN TRUNC(Upd_Qty_Ratio) = Upd_Qty_Ratio THEN TO_CHAR(Upd_Qty_Ratio) || 'C' ELSE TO_CHAR(TRUNC(UPDATE_QTY)) || 'C' || ' ' || TO_CHAR(ROUND(MOD(Upd_Qty_Ratio, 1) * USER_DEF_NUM_3, 6)) || 'U' END CU_Sum FROM ( SELECT DISTINCT FROM_LOC_ID, S.SKU_ID, S.DESCRIPTION, ITL.UPDATE_QTY, S.USER_DEF_NUM_3, OH.ORDER_ID, ITL.CONSIGNMENT, ITL.PALLET_ID, NVL(ITL.UPDATE_QTY,0)*NVL(S.EACH_WEIGHT,0) Weight, ITL.UPDATE_QTY/(CASE S.USER_DEF_NUM_3 WHEN 0 THEN 1 ELSE S.USER_DEF_NUM_3 END) Upd_Qty_Ratio FROM INVENTORY_TRANSACTION ITL, SKU S, LOCATION L, ORDER_HEADER OH WHERE ITL.SKU_ID = S.SKU_ID AND ITL.CODE = 'Pick' AND ITL.CONSIGNMENT = $P{Consignment} AND OH.ORDER_DATE = TO_CHAR($P{Date}, 'DD-Mon-YYYY') AND OH.ORDER_ID = ITL.REFERENCE_ID AND ITL.TO_LOC_ID = 'CONTAINER')) SELECT DISTINCT ORDER_ID, CONSIGNMENT, WEIGHT, PALLET_ID, CU_Sum, (SELECT NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'U') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'C',NULL) END)),'0') ||'C' || ' ' || NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'C') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'U',NULL) END)),'0') ||'U' FROM SKU_DATA) AS Total_Cu_Sum FROM SKU_DATA
SM.Hello Sam, what is the error, and what has changed since he was executed successfully?
-
Wait for the mechanism in the parallel execution of packages
Dear all,
I submit two packets in parallel as below, which works very well.
I present this in a shell script which is registered as a front end program.
Front end program completed in a second, while the data are not visible in the tables, the data is visible only when the execution of the package completed.
Please can you suggest a mechanism so that I can make the plsql block in shell script to wait for both the delivery of completed packages.
#!/bin/sh | . $CUST_TOP/bin/CUST_ID_CM.env export INFA_USER=$INFA_USER export userpass=`(echo $1 | cut -f2 -d'"' | cut -d '"' -f3)` ploadtype=$5 pyear=$7 ##################################################################### if [ "$ploadtype" = "Restatement" ]; then sqlplus -s $userpass <<EOF set heading off feedback off verify off serveroutput on spool /usr/tmp/tmp_tph_load.txt DECLARE l_cnt NUMBER; BEGIN DBMS_SCHEDULER.CREATE_JOB(job_name => 'YEARLY_RESTATEMENTS', job_type => 'STORED_PROCEDURE', job_action => 'RESTATEMENTS_DATAFEED_PKG.INSERT_RESTATEMENTS_P', number_of_arguments => 1, enabled => FALSE, auto_drop => TRUE); DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(job_name => 'YEARLY_RESTATEMENTS', argument_position => 1, argument_value => '$7'); DBMS_SCHEDULER.ENABLE('YEARLY_RESTATEMENTS'); DBMS_SCHEDULER.CREATE_JOB(job_name => 'YEARLY_ACTUALS', job_type => 'STORED_PROCEDURE', job_action => 'ACTUALS_DATAFEED_PKG.INSERT_ACTUALS_P', number_of_arguments => 1, enabled => FALSE, auto_drop => TRUE); DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(job_name => 'YEARLY_ACTUALS', argument_position => 1, argument_value => '$7'); DBMS_SCHEDULER.ENABLE('YEARLY_ACTUALS'); LOOP SELECT COUNT(1) INTO l_cnt FROM DBA_SCHEDULER_RUNNING_JOBS WHERE UPPER(job_name) IN (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements')); EXIT WHEN l_cnt < 1; END LOOP; END; / EOF # fi exit
Your problem is the timing. You can perform the check at DBA_SCHEDULER_RUNNING_JOBS before the entry is actually in there.
Here is an example. I just submitted a PLSQL_BLOCK waiting for 60 seconds.
SQL> DECLARE 2 l_cnt NUMBER; 3 BEGIN 4 dbms_output.put_line(systimestamp || ' - Started'); 5 DBMS_SCHEDULER.CREATE_JOB(job_name => 'YEARLY_RESTATEMENTS', 6 job_type => 'PLSQL_BLOCK', 7 job_action => 'BEGIN DBMS_LOCK.SLEEP(60); END;', 8 enabled => FALSE, 9 auto_drop => TRUE); 10 DBMS_SCHEDULER.ENABLE('YEARLY_RESTATEMENTS'); 11 12 LOOP 13 SELECT COUNT(1) into l_cnt 14 FROM DBA_SCHEDULER_RUNNING_JOBS 15 WHERE UPPER(job_name) IN 16 (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements')); 17 18 EXIT WHEN l_cnt < 1; 19 dbms_output.put_line(systimestamp || ' - Waiting'); 20 dbms_lock.sleep(10); 21 END LOOP; 22 dbms_output.put_line(systimestamp || ' - Completed'); 23 END; 24 / 04-DEC-14 02.32.00.075794000 AM -05:00 - Started 04-DEC-14 02.32.00.121862000 AM -05:00 - Completed PL/SQL procedure successfully completed.
Now it ends immediately. But you can see that the job is still running.
SQL> SELECT COUNT(1) 2 FROM DBA_SCHEDULER_RUNNING_JOBS 3 WHERE UPPER(job_name) IN 4 (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements')); COUNT(1) ---------- 1
Now I make my code to wait 5 seconds before the audit
SQL> DECLARE 2 l_cnt NUMBER; 3 BEGIN 4 dbms_output.put_line(systimestamp || ' - Started'); 5 DBMS_SCHEDULER.CREATE_JOB(job_name => 'YEARLY_RESTATEMENTS', 6 job_type => 'PLSQL_BLOCK', 7 job_action => 'BEGIN DBMS_LOCK.SLEEP(60); END;', 8 enabled => FALSE, 9 auto_drop => TRUE); 10 DBMS_SCHEDULER.ENABLE('YEARLY_RESTATEMENTS'); 11 12 -- Wait for a wile before checking 13 dbms_lock.sleep(5); 14 LOOP 15 SELECT COUNT(1) into l_cnt 16 FROM DBA_SCHEDULER_RUNNING_JOBS 17 WHERE UPPER(job_name) IN 18 (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements')); 19 20 EXIT WHEN l_cnt < 1; 21 dbms_output.put_line(systimestamp || ' - Waiting'); 22 dbms_lock.sleep(10); 23 END LOOP; 24 dbms_output.put_line(systimestamp || ' - Completed'); 25 END; 26 / 04-DEC-14 02.33.09.294256000 AM -05:00 - Started 04-DEC-14 02.33.14.347866000 AM -05:00 - Waiting 04-DEC-14 02.33.24.369777000 AM -05:00 - Waiting 04-DEC-14 02.33.34.389725000 AM -05:00 - Waiting 04-DEC-14 02.33.44.410508000 AM -05:00 - Waiting 04-DEC-14 02.33.54.430561000 AM -05:00 - Waiting 04-DEC-14 02.34.04.450684000 AM -05:00 - Waiting 04-DEC-14 02.34.14.462191000 AM -05:00 - Completed PL/SQL procedure successfully completed. SQL>
Now you can see the code entered in the loop and waited.
-
How to avoid the parallel execution
Hello!
In my database is this undesirable parallelization of the query.
All of the tables involved a degree = 1,
If I just figured there is no method to avoid this problem except reduction of the degree of index?
I'm usung 11.2.0.3
Thank you and best regards,
PavelWell, you can use the NOPARALLEL hint if you do not want parallelism to be there.
Aman...
-
How to write the result of a SQL query to a text file?
I'm using Oracle 11 g and SQL Plus.
I have a large table called side.
Whenever I do
SQL > select * rating.
The output goes well beyond what can show the screen sqlplus. So, I want to store the result of this query in a text file.
How is that possible? Help, please. Thank you.SQL > SPOOL results.txt
SQL > select * rating.
SQL > SPOOL OFF -
Need help for the Partition of PL/SQL query for a question
Hi all
I'm running on a question that I'm not able to get the desired result. I would appreciate if one of you experts can help resolve this.SQL * more: Production of release 11.2.0.1.0 game 4 Feb 09:31:26 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.Connected to:
Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
with t as)
Select 1 numero_enregistrement, Student_ID 123, nvl (trim (01), 'NULL') like Item_id, 'ITEM_ID_01' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_02' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_03' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_04' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_05' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_06' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('01'), 'NULL') like Item_id, 'ITEM_ID_01' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('02'), 'NULL') like Item_id, 'ITEM_ID_02' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('03'), 'NULL') like Item_id, 'ITEM_ID_03' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('01'), 'NULL') like Item_id, 'ITEM_ID_04' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('01'), 'NULL') like Item_id, 'ITEM_ID_05' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('02'), 'NULL') like Item_id, 'ITEM_ID_06' double FIELD_NAME)
SELECT distinct COUNT (*) OVER (PARTITION BY numero_enregistrement ORDER BY numero_enregistrement) REC_COUNT, numero_enregistrement, STUDENT_ID, ITEM_ID, Field_Name FROM t
where ITEM_ID = 'NULL '.I get the following result.
NUMERO_ENREGISTREMENT ITEM_ID FIELD_NAME STUDENT_ID REC_COUNT
5 1 123 NULL ITEM_ID_02
5 1 123 NULL ITEM_ID_03
5 1 123 NULL ITEM_ID_04
5 1 123 NULL ITEM_ID_05
5 1 123 NULL ITEM_ID_06
My desired output isRec_COUNT Student_ID ITEM_ID FIELD_NAME numero_enregistrement
5 1 123 NULL ITEM_ID_02, ITEM_ID_03, ITEM_ID_04, ITEM_ID_04, ITEM_ID_05Thanks in advance
Rajesh
Hi, Renon,
Thanks for posting the sample data and results; It is very useful.
Be sure to explain exactly how you get these results from these data. There are many different reasons you may have, that all happen to produce the same results with the sample data you posted, but will get different results with other data sets.
This looks like a job for aggregate (including the LISTAGG) functions and GROUP BY, not for functions, analytical and PARTITION BY
-
Execution of SQL query for slow down
Hey all!
I use 10g express with apex 3.1 edition, when I run this query:
Select asig.idasig IDASIG, asig.idAsig 'C & oacute; Digo Asignatura", ID asig.idasig, substr (asig.codigoasig |) » '|| ASiG.nombre, 0, 40) "Asignatura", p.nombre | " '|| 'Responsible' p.apellidos, t.usuario 'T & eacute; Técnico", substr (ea.estado, 0, 22)"Estado not', ec.estado "Certificado de Estado", cert.idestado
certificado cert, asignatura asig, histasig ha, profesor Técnico t, p, estado, estado ea
where cert.idasig = asig.idasig and
p.idprof = asig.idprof and
t.idtecnico = asig.idtecnico and
* cert.idasig (cert.fecha) in (select idasig, max (date) of the Group idasig certificado) and *.
EC.idestado = cert.idestado and
HA.idasig = asig.idasig and
* ha.idasig (ha.fecha) in (select idasig, max (date) of the histasig of idasig group) and *.
EA.idestado = ha.idestado
It is too slow, making the query gets results in approximately 149 s.
Can someone give me an idea...
PD: the case is that we have another query that do almost the same thing but with this one, I get the results in less than 1 s.Just posting your query without any other information is meaningless for us.
Start by reading this thread...
[When your query takes too long... | http://forums.oracle.com/forums/thread.jspa?messageID=1812597#1812597]
-
How to move the Page Item in SQL query
Hello, I have a need to transmit a page element in a function, plsql on the way but none of it works according to the following. What Miss me?
I tried immediately, but no luck.select aplsqlfunction(:P29_X) from dual;
: P29_X
#P29_X #.
& P29_X.
P29_X
Thank you
R
Published by: Rich V on June 6, 2010 16:55Well then...
Select aplsqlfunction (V('P29_X') AS Xyz of double;
Thank you
Tony Miller
Webster, TX -
need help with the place where small sql query
types of numbers names {}
ID | name | ID | Phone | which | type of | ID | type |
| 1. Jenny | 1. 867-5309 | 1. 3 | | 1. Home |
| 4: Tom | 4: 555-1212. 3. 1 | | 4: cell |
| 3. Smith | 3. 364-4311 | 3. 2 | | 3. work |
| 4. Amy | 4. 936-2828 | 4. 3 | | 4. Fax |
| 5. 525-8722 | 3. NULL | -----------
----------------------------
I'm currently out put like this:
Type name phone
| Smith | Home | 555-1212 |
| Smith | cell | 364-4311 |
| Smith | NULL | 525-8722 |
is it possible to get the time of the tree 'smith' in the name column, which confuses me a lot
{Please can someone give idea how to solve this problem}
Published by: user4463478 on May 20, 2009 17:38
Edited by: user4463478 May 21, 2009 11:51
Edited by: user4463478 May 21, 2009 11:52select n.name,t.type,s.phone from names n,numbers s,types t where n.id=s.who and s.type=t.id(+)---right outer join and name ='&name'
Here go us
-
Performance problem on the SQL query that does not use the primary key index
Hello!
I have some performance issues on a single SQL query (Oracle 10 g).
I could solve the problem by using the INDEX indicator, but I would like to know WHY this is happening.
* Tables *.
create table jobs)
ID number (5) not null,
name varchar2 (100),
primary key constraint Job_PK (id)
)
/
-Record count: 298
create table Comp)
integer ID not null,
name varchar2 (100),
primary key constraint Comp_PK (id)
)
/
-Record count: 193
-Relation m: n
create table JobComp)
integer ID not null,
id_job integer not null,
id_comp integer not null,
primary key constraint JobComp_PK (id),
unique key constraint JobComp_UK (id_job, id_comp),
Constraint JobComp_FK_Job foreign key (id_job) refers to Job (id),
Constraint JobComp_FK_Comp foreign key (id_comp) makes reference Comp (id)
)
/
create index JobComp_IX_Comp on JobComp (Cod_Comp)
/
create index JobComp_IX_Job on JobComp (Cod_Job)
/
-Record count: 6431
* Ask *.
When I run this query, the execution plan shows the index using (JobComp_PK and JobComp_IX_Comp).
No problem.
Select JobComp.*
of JobComp
Join jobs
on Job.id = JobComp.id_job
where JobComp.id_comp = 134
/
-runs in 0.20 sec
But when I add the field 'name' of the work table the plan uses full access table to the table of work
Select JobComp.*, Job.name
of JobComp
Join jobs
on Job.id = JobComp.id_job
where JobComp.id_comp = 134
/
-runs in the 2.70 dry
With the help of the index
Select / * + INDEX (Job Job_PK) * /.
JobComp.*, Job.name
of JobComp
Join jobs
on Job.id = JobComp.id_job
where JobComp.id_comp = 134
/
-runs in 0.20 sec
* Doubt *.
This behavior is correct?
PS. : I tried to recalculate the statistics, but nothing changes:
analyze the job calculation table statistics.
/
change the statistical calculation of index Job_PK reconstruction;
/
Start
dbms_utility.analyze_schema (sys_context ('userenv', 'current_schema'), 'CALCULATE');
end;
/
[of]
Gustavo EhrhardtGus.EHR wrote:
Hello.
I'm sorry for the plan unformatted.
The execution time of the querys "without field name' and 'with the field name with suspicion" are equal.
He has no problem caching, because I get the plans of the sequence different from the querys and repeated the performance. The result is always the same.I don't think that there is no problem with oracle crossing LOOP IMBRIQUEE to the HASH JOIN when you include the field name and this should be the expected behavior. But it seems that your WORKING table has a degree of parallelism set against what is causing the query to run in parallel (as JOB table is now available with full table scan, instead of indexed access earlier). It could be that the parallel execution is contributor to extra Runtime.
(a) do you know why the degree of parallelism on the WORK table has been defined? Do you need it?You can see if the following query provides a better response time?
select /*+ NOPARALLEL(JOB) */ JobComp.*, Job.Name from JobComp join Job on Job.id = JobComp.id_job where JobComp.id_comp = 134
Maybe you are looking for
-
How delete my themes or the photo in my mozzila can give me an answer?
How can I delete my themes and return based mozilla... no picture my mind...? in aad - ons
-
New on Satellite Pro 6100 WLAN card installed, but can not be activated
Hi, just replaced the internal Wireless LAN card on my laptop Satellite Pro 6100. Map of yesterday and today have the same problem: I can't turn them on. They are installed properly and supposed to run in what concerns the XP drivers, but does not de
-
Satellite L35D screen goes black periodically
I looked through the various discussions forum on the screens black but can't seem to find one like mine. When its not an overheating and cutting (another problem since!) It works for the most part fine, but lately the screen empties suddenly without
-
Vista Windows versus windows cp
can I install windows xp on top of windows vista. If so, please tell me how. I want to get rid of vista for good. It was pre-installed on my computer lenovo with the windows validation key appropriate, but I don't do it and want to go back to wo win
-
Driver 4100/4600 (UMAX) ASTRA for windows 8
I need this driver for windows 8, please help me