the group causing a Cartesian merge join?
Hi allDatabase Version: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
Database Version: PL/SQL Release 10.2.0.5.0 - Production
I wrote a query that runs in less than a second and produced a few hundred lines (as you can see below). I wanted only to find the number of separate incidents ID returned so I put a group by at the end and it ran forever.I realized a plan to explain (as shown below) to the query with the group inside and he tries to make a Cartesian join!
A WTF happening? I've never known a group by statement before.
basic structure of the tables is the following:
SQL> desc answer_master
Name Null? Type
------------------------------------------------------------------------ -------- -----------------
ANSWER_ID NOT NULL NUMBER(12)
INCIDENT_ID NOT NULL NUMBER(12)
PLAN_ID NOT NULL NUMBER(12)
QUESTION_ID NOT NULL NUMBER(12)
SQL> desc question_master
Name Null? Type
------------------------------------------------------------------------ -------- -----------------
QUESTION_PLAN_ID NOT NULL NUMBER(12)
QUESTION_ID NOT NULL NUMBER(12)
QUESTION_TYPE NOT NULL NUMBER(2)
QUESTION_TEXT NOT NULL VARCHAR2(255)
QUESTION_PARENT_ID NUMBER(12)
the SQL statementSQL> explain plan for
2 select incident_id
3 from answer_master am
4 where exists (select 'x'
5 from answer_master am1
6 where question_id in (select question_id
7 from question_master qms
8 where question_plan_id = 1477
9 and question_parent_id = 69067
10 and substr(question_text,-3) = 'PDF')
11 and am1.incident_id = am.incident_id)
12 and exists (select 'x'
13 from answer_master am1
14 where question_id in (select question_id
15 from question_master qms
16 where question_plan_id = 1477
17 and question_parent_id = 69067
18 and substr(question_text,-3) != 'PDF')
19 and am1.incident_id = am.incident_id);
Explained.
Elapsed: 00:00:00.01
SQL> set linesize 132;
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1710257923
----------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 32 | 171 (6)| 00:00:01 |
|* 1 | HASH JOIN RIGHT SEMI | | 1 | 32 | 171 (6)| 00:00:01 |
| 2 | VIEW | VW_SQ_2 | 71 | 923 | 70 (5)| 00:00:01 |
| 3 | NESTED LOOPS | | 71 | 3266 | 70 (5)| 00:00:01 |
|* 4 | TABLE ACCESS BY INDEX ROWID | QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 |
|* 6 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 18731 | 201K| 68 (5)| 00:00:01 |
| 7 | NESTED LOOPS | | 304 | 5776 | 100 (5)| 00:00:01 |
| 8 | VIEW | VW_SQ_1 | 14 | 182 | 70 (5)| 00:00:01 |
| 9 | HASH UNIQUE | | 14 | 644 | | |
| 10 | NESTED LOOPS | | 14 | 644 | 70 (5)| 00:00:01 |
|* 11 | TABLE ACCESS BY INDEX ROWID| QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 |
|* 12 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 |
|* 13 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 18731 | 201K| 68 (5)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX3 | 22 | 132 | 2 (0)| 00:00:01 |
----------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("ITEM_2"="AM"."INCIDENT_ID")
4 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)!='PDF')
5 - access("QUESTION_PARENT_ID"=69067)
6 - access("QUESTION_ID"="QUESTION_ID")
11 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)='PDF')
12 - access("QUESTION_PARENT_ID"=69067)
13 - access("QUESTION_ID"="QUESTION_ID")
14 - access("ITEM_1"="AM"."INCIDENT_ID")
33 rows selected.
Elapsed: 00:00:00.06
SQL> explain plan for
2 select incident_id
3 from answer_master am
4 where exists (select 'x'
5 from answer_master am1
6 where question_id in (select question_id
7 from question_master qms
8 where question_plan_id = 1477
9 and question_parent_id = 69067
10 and substr(question_text,-3) = 'PDF')
11 and am1.incident_id = am.incident_id)
12 and exists (select 'x'
13 from answer_master am1
14 where question_id in (select question_id
15 from question_master qms
16 where question_plan_id = 1477
17 and question_parent_id = 69067
18 and substr(question_text,-3) != 'PDF')
19 and am1.incident_id = am.incident_id)
20 group by incident_id;
Explained.
Elapsed: 00:00:00.00
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1433543102
-----------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 98 | 77 (6)| 00:00:01 |
| 1 | HASH GROUP BY | | 1 | 98 | 77 (6)| 00:00:01 |
| 2 | NESTED LOOPS | | 1 | 98 | 76 (4)| 00:00:01 |
| 3 | NESTED LOOPS | | 1 | 87 | 74 (5)| 00:00:01 |
| 4 | NESTED LOOPS | | 1 | 81 | 72 (5)| 00:00:01 |
| 5 | MERGE JOIN CARTESIAN | | 1 | 70 | 4 (0)| 00:00:01 |
|* 6 | TABLE ACCESS BY INDEX ROWID | QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 |
| 8 | BUFFER SORT | | 1 | 35 | 2 (0)| 00:00:01 |
|* 9 | TABLE ACCESS BY INDEX ROWID| QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 |
|* 11 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 18731 | 201K| 68 (5)| 00:00:01 |
|* 12 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX3 | 22 | 132 | 2 (0)| 00:00:01 |
|* 13 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 1 | 11 | 2 (0)| 00:00:01 |
-----------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
6 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)='PDF')
7 - access("QUESTION_PARENT_ID"=69067)
9 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)!='PDF')
10 - access("QUESTION_PARENT_ID"=69067)
11 - access("QUESTION_ID"="QUESTION_ID")
12 - access("AM1"."INCIDENT_ID"="AM"."INCIDENT_ID")
13 - access("QUESTION_ID"="QUESTION_ID" AND "AM1"."INCIDENT_ID"="AM"."INCIDENT_ID")
31 rows selected.
Elapsed: 00:00:00.00
SQL> spool off
Edit: change superiors--more/less to signs of! = to display the ForumPublished by: WhiteHat on February 11, 2011 09:37
In addition, if you are interested in rewriting so I think this might be an alternative (untested):
select am1.incident_id
from answer_master am1
, question_master qms
where am1.question_id = qms.question_id
and qms.question_plan_id = 1477
and qms.question_parent_id = 69067
group by am1.incident_id
having max(case when substr(qms.question_text,-3) = 'PDF' then 1 else 0 end) !=
min(case when substr(qms.question_text,-3) = 'PDF' then 1 else 0 end);
Tags: Database
Similar Questions
-
Hi all
I have a problem in writing the query below. The following query always shows a MERGE JOIN CARTESIAN in the plan to explain due to which the execution of the query takes a long time (almost 2 hours for 1,000 records).
I use "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi. Please advice if I need to provide more information on that.
-----Select to_char(a.amnt_date,'DD-MON-YYYY') amnt_date, SUM(a.AMNT_CON) amount from amount a, (SELECT area_no FROM (SELECT * FROM area_usage WHERE area_hier_no = '201064') CONNECT BY area_par_no = PRIOR area_no START WITH area_no in (SELECT area_no FROM area WHERE area_code in ('EQ'))) b, (SELECT acc_no FROM (SELECT * FROM acc_usage WHERE acc_hier_no = '1') CONNECT BY acc_par_no = PRIOR acc_no START WITH acc_no = 202917) c -- Account Hierarchy where a.area_no = b.area_no AND a.acc_no = c.acc_no GROUP BY a.amnt_date
PLAN_TABLE_OUTPUT
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hash value of plan: 2492729134
-----------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |
-----------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 692. 22144 | 3327 (32) | 00:00:40 |
| 1. HASH GROUP BY. 692. 22144 | 3327 (32) | 00:00:40 |
| 2. TABLE ACCESS BY LOCAL INDEX ROWID | AMOUNT | 138. 2898. 3326 (32) | 00:00:40 |
| 5: NESTED LOOPS | 692. 22144 | 3326 (32) | 00:00:40 |
| 4. THE CARTESIAN MERGE JOIN. 5. 55. 13 (0) | 00:00:01 |
| 5. VIEW | 1. 5. 5 (0) | 00:00:01 |
|* 6 | CONNECT BY WITH FILTERING |
| 7. TABLE ACCESS BY INDEX ROWID | ACC_USAGE | 1. 24. 2 (0) | 00:00:01 |
|* 8 | INDEX UNIQUE SCAN | ACU_PK | 1 | | 1 (0) | 00:00:01 |
| 9. NESTED LOOPS |
| 10. CONNECT PUMP |
| * 11 | TABLE ACCESS BY INDEX ROWID | ACC_USAGE | 1. 14. 5 (0) | 00:00:01 |
| * 12 | INDEX RANGE SCAN | ACU_AH_HAVE_AS_PARENT_FK_I | 4 | | 1 (0) | 00:00:01 |
| 13. KIND OF BUFFER. 5. 30. 13 (0) | 00:00:01 |
| 14. VIEW | 5. 30. 8 (0) | 00:00:01 |
| * 15 | CONNECT BY WITH FILTERING |
| * 16. TABLE ACCESS BY INDEX ROWID | AREA_USAGE |
| 17. NESTED LOOPS | 1. 32. 2 (0) | 00:00:01 |
| 18. TABLE ACCESS BY INDEX ROWID | AREA | 1. 21. 2 (0) | 00:00:01 |
| * 19. INDEX UNIQUE SCAN | AR_AR2_UK | 1 | | 1 (0) | 00:00:01 |
| * 20. INDEX UNIQUE SCAN | AU_PK | 8608. 94688 | 0 (0) | 00:00:01 |
| 21. NESTED LOOPS |
| 22. CONNECT PUMP |
| * 23. TABLE ACCESS BY INDEX ROWID | AREA_USAGE | 5. 85. 8 (0) | 00:00:01 |
| * 24. INDEX RANGE SCAN | ARU_APN_FKI | 8 | | 1 (0) | 00:00:01 |
| 25. RANGE OF PARTITION ALL THE | 1. 60.
| 26. CONVERSION OF BITMAP IN ROWID |
| 27. BITMAP AND |
| 28. CONVERSION OF BITMAP OF ROWID |
| * 29. INDEX RANGE SCAN | A_ARH_FK_I | 194K | 134 (7) | 00:00:02 | 1. 60.
| 30. CONVERSION OF BITMAP OF ROWID |
| * 31. INDEX RANGE SCAN | A_AH_FK_I | 194K | 488 (41) | 00:00:06 | 1. 60.
-----------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
6 - access("ACC_USAGE".") ACC_PAR_NO "="ACC_USAGE"ADVANCE." ACC_NO")
8 - access("ACC_USAGE".") ACC_NO "= 202917 AND ACC_HIER_NO" = 1) «»
11 - filter ("ACC_HIER_NO" = 1)
12 - access("ACC_USAGE".") ACC_PAR_NO "="ACC_USAGE"ADVANCE." ACC_NO")
15 - access("AREA_USAGE".") AREA_PAR_NO "="AREA_USAGE"ADVANCE." AREA_NO')
16 - filter ("AREA_HIER_NO" = 201064)
19 - access ("AREA_CODE" = 'EQ')
20 - access ("AREA_HIER_NO"= "AREA_USAGE" AND 201064." AREA_NO "=" AREA_NO")
23 - filter ("AREA_HIER_NO" = 201064)
24 - access("AREA_USAGE".") AREA_PAR_NO "="AREA_USAGE"ADVANCE." AREA_NO')
29 - access("A".") AREA_NO '=' B '. ("' AREA_NO")
31 - access("A".") ACC_NO '=' C '. ("' ACC_NO")
54 selected lines.
Published by: Williams James Henderson on October 14, 2010 05:31It is a very small difference, and I don't expect to cause huge changes in an execution plan. Either way to collect statistics, you would use the DBMS_STATS package.
Furthermore, your "formatted" execution plan is not exactly readable in your message.
Looking at your request a little more closely, I recommend you remove the SELECT * from subqueries. Something like that may be sufficient:
Select to_char(a.amnt_date,'DD-MON-YYYY') amnt_date, SUM(a.AMNT_CON) amount from amount a, (SELECT area_no FROM (SELECT area_no , area_par_no FROM area_usage WHERE area_hier_no = '201064') CONNECT BY area_par_no = PRIOR area_no START WITH area_no in (SELECT area_no FROM area WHERE area_code in ('EQ'))) b, (SELECT acc_no FROM (SELECT acc_no , acc_par_no FROM acc_usage WHERE acc_hier_no = '1') CONNECT BY acc_par_no = PRIOR acc_no START WITH acc_no = 202917) c -- Account Hierarchy where a.area_no = b.area_no AND a.acc_no = c.acc_no GROUP BY a.amnt_date
A SELECT statement using * and not at a later time using all the columns hides valuable information from Oracle. If you provide only the columns used Oracle may be able to find a better plan of execution.
Given that I don't know the structures of table if you can actually use all the columns. I still recommend the amendment because I think that it makes the code easier to understand.
-
is "join Cartesian" identical "merge join Cartesian"?
Hi guys,.
my plan to explain said the Cartesian merge join
[Oracle documentation | http://download-west.oracle.com/docs/cd/B10500_01/server.920/a96533/optimops.htm#45485] speaks of Cartesian join
Are these two the same?
Thank youHello
Both are the same but the NAP differs from 9i to 10g, since according to the algorithm basedon Version in! 0 g's
Kind of buffer.Look at the example of wirh links.
http://www.juliandyke.com/optimisation/operations/MergeJoinCartesian.html
http://www.akadia.com/services/ora_interpreting_explain_plan.html-Pavan Kumar N
-
Is the merge join Cartesian intensibe more CPU than nested loops?
Hello
just wonderning which access method is more intensive CPU, supposed to leave we got 2 the same rank sources and make joing via merge join Cartesian and then case is nested loop.
I know that nl can be CPU due to the tight loop access, but what abour MJC?
I can see bufferd sort but not sure is that cpu friendly?
Concerning
GregGThe simplest answer I think is "it depends on the situation." Two of them could be disaster in different situations. Nested loops are suitable for a type of join and Cartesian for another.
-
Hello
I recently changed to the last Bold 9900 of torch. Since the change, I have a 2 additional icons for my existing BBM groups (Fam & friends). They have the status of "Waiting to join...." ». I am able to access these groups and to discuss with members. However, the 2 additional icons are really bugging me. Any way to remove them? I couldn't not remove option for these 2 icons. Thank you.
Rgds,
POH Huat
Found the solution! Just delete the application Blackberry Messenger via Options > device > application management. Once deleted, reinstall Blackberry Messenger via App World. Alto! 2 additional groups have disappeared!
Note that you may need your group to withdraw from the Group and invite you.
-
Message: Need IPv6 to join the Group of home when he tried to join the group home
Original title: IPv6
When I try to join a homegroup on this computer, I get a message that says I need IPv6. I clicked on the adapter and went to proberties and I have IPv6 installed and it has a check mark in the box. So, it should work. When I clik on the link and go to properties and don't look at the IPv6 connection it say no internet. What this means and how to get it to connect. Man this is proving to be a mess.
Hi billgoodwin,
Try the steps mentioned by "Novak Wu MSFT, Moderator Monday, November 2, 2009 01:06" and check the result. See IPv6 must join home group
For reference, see why I can't join a homegroup?
Visit our Microsoft answers feedback Forum and let us know what you think.
-
What is the difference between the Group and join?
I understand what is the grouping of contacts. and I saw the impact of joinging contacts but why would I do that? He takes the contacts that join off the my list of good contacts individuals list is deleted and all that remains is the name of the principal that joined you.
Why do this?
If you have the same contact in more than one group of Gmail, the droid will join them together. This prevents duplicates appear in the contacts list.
-
Need help in the optimization of the query with the Group and joins by clause
I'm having the problem by running the following query... It takes a lot of time. To simplify, I added the two tables FILE_STATUS = stores the file load details and COMM table Board table job showing records treated successfully and which was communicated to the other system real. Records with status = T is trasnmitted to another system and traansactions with P is waiting.
Here's the query I wrote to give me the details of the file that has been loaded into the system. He reads the table of State and the commission files to display the name of the file, total records loaded, total at the table of the commission and the number of records which has finally been passed successfully loaded (Status = T) with other systems.CREATE TABLE FILE_STATUS (FILE_ID VARCHAR2(14), FILE_NAME VARCHAR2(20), CARR_CD VARCHAR2(5), TOT_REC NUMBER, TOT_SUCC NUMBER); CREATE TABLE COMM (SRC_FILE_ID VARCHAR2(14), REC_ID NUMBER, STATUS CHAR(1)); INSERT INTO FILE_STATUS VALUES ('12345678', 'CM_LIBM.TXT', 'LIBM', 5, 4); INSERT INTO FILE_STATUS VALUES ('12345679', 'CM_HIPNT.TXT', 'HIPNT', 4, 0); INSERT INTO COMM VALUES ('12345678', 1, 'T'); INSERT INTO COMM VALUES ('12345678', 3, 'T'); INSERT INTO COMM VALUES ('12345678', 4, 'P'); INSERT INTO COMM VALUES ('12345678', 5, 'P'); COMMIT;
In production, this request has several joins and takes a long time to deal with... the main culprit for me is the join on the COMM table to count the number of number of transactions sent. Please can you give me tips to optimize this query to get results faster? What I need to delete the Group and use the partition or something else. Help, please!SELECT FS.CARR_CD ,FS.FILE_NAME ,FS.FILE_ID ,FS.TOT_REC ,FS.TOT_SUCC ,NVL(C.TOT_TRANS, 0) TOT_TRANS FROM FILE_STATUS FS LEFT JOIN ( SELECT SRC_FILE_ID, COUNT(*) TOT_TRANS FROM COMM WHERE STATUS = 'T' GROUP BY SRC_FILE_ID ) C ON C.SRC_FILE_ID = FS.FILE_ID WHERE FILE_ID = '12345678';
Don't know if it will be faster based on the information provided, but analytical functions offer an alternative approach;
select carr_cd, file_name, file_id, tot_rec, tot_succ, tot_trans from (select fs.carr_cd, fs.file_name, fs.file_id, fs.tot_rec, fs.tot_succ, count(case when c.status = 'T' then 1 else null end) over(partition by c.src_file_id) tot_trans, row_number() over(partition by c.src_file_id order by null) rn from file_status fs left join comm c on c.src_file_id = fs.file_id where file_id = '12345678') where rn = 1; CARR_CD FILE_NAME FILE_ID TOT_REC TOT_SUCC TOT_TRANS ------- -------------------- -------------- ---------- ---------- ---------- LIBM CM_LIBM.TXT 12345678 5 4 2
-
This issue just started about 4 days after years of good impression on the computers in the homegroup. Nothing I know came to start this problem.
Printers cannot be seen by the remote PC that needs to connect to printers via homegroup. Printers, 2, a laser and the other color ink jet, showed both on the remote PC called but also showed "offline", I tried to find ways to put on line, but nothing could fill this function. I read a suggestion that I should remove the printer and then recharge it. I removed the printer and is where I found that I couldn't see the printer on the network of homegroup to reload.
I rebooted the bridge and the two PCs and turned off the firewall and virus protection software and closed the Group residential and the recreated homegroup and pretty much any other start-up base and installation process you can think, and nothing gets my functional printers through the remote PC. I even physically removed one of the printers of the main PC and deleted the software and then reconnected and recharged and have made sure I have the latest drivers and it made no difference at all.
Hello
post here for better support:
http://social.technet.Microsoft.com/forums/en-us/w7itprovirt/threads
-
Join the tool causes deformation
When I try to unify this (converted to outlines) text with the rectangle above - objects are distorted. The top image is before you join the object, the bottom is after. I can't understand why this is happening - suggestions? (I'm using CS5) Thank you!
It's strange. Look at your window Appearance to see if you have rounded corners in the element. If so, just trash...
-
Error NoPermission when the vCenter access is provided via the Group
Hi all
I installed the new vcenter 5.1.0 1123961 on 2012 OS Server (the server is joined to AD).
If we give access to the user directly, they can log in via vSphere vCenter / Webclient with numbers.
If we give access to the AD Group, and make user group member, admin users get error NoPermission.
We have the administrator authority give the Group on the vCenter server, do not know what is the cause of the problem.
VCenter server log.Vim. SessionManager.login: vim.fault.NoPermission:
-> Result:
-> (vim.fault.NoPermission) {}
-> dynamicType = < unset >
-> faultCause = (vmodl. NULL in MethodFault),
-> subject = ' vim. File: Group-d1',.
-> privilegeId = "System.View."
-> msg = ""
->}
-> Args:
->
Tech VM ware asked to install 2.0 SSO, it is know issue in vcenter 5.1 AU
-
The slow queries with WITH and JOIN
Hello
This code takes too long to complete:
If I remove "WHERE Id_compteur = 4" on the last line, there is almost no difference in run time. Without this WHERE clause, it returns 1104 ranks in s 1.51, with her he returned 116 lines s 1.34.WITH rawData AS -- 563 rows in 0.07s OR 59 rows in 0.02s ( SELECT date_releve AS x1, index_corrige AS y1, LEAD(date_releve) OVER (PARTITION BY id_compteur ORDER BY date_releve) AS x2, LEAD(index_corrige) OVER (PARTITION BY id_compteur ORDER BY date_releve) AS y2, id AS id_releve, id_compteur FROM V_relevesCorriges ), meteoData AS -- 1082 rows in 1.34s OR 116 rows in 0.16s ( SELECT avg(meteo.valeur) AS meteoValue, x2 AS dateMeteo, id_variable, id_releve, id_compteur FROM meteo, rawData WHERE date_meteo <= x2 AND date_meteo > x1 GROUP BY id_releve, id_variable, x2, id_compteur ORDER BY x2 ), consoData AS -- 1104 rows in 1.43s, 117 rows in 0.2s ( SELECT to_char(x1, 'DD.MM.YYYY') || ' - ' || to_char(x2, 'DD.MM.YYYY') AS periode, meteoValue AS meteo_moyenne, (y2 - y1) / nullif((x2 - x1),0) AS conso_par_jour, (y2 - y1) AS conso, rawData.id_releve id_releve, meteoData.id_variable id_variable, meteoData.id_compteur id_compteur FROM rawData LEFT OUTER JOIN meteoData ON rawData.id_releve = meteoData.id_releve ORDER BY x2 ) SELECT periode, meteo_moyenne, conso_par_jour, consoData.id_variable id_variable, consoData.id_releve id_releve, id_compteur -- 1104 rows in 1.51s, 116 rows in 1.34s FROM consoData LEFT OUTER JOIN diagnostic2 ON consoData.id_releve = diagnostic2.id_releve AND consoData.id_variable = diagnostic2.id_variable WHERE Id_compteur = 4
I say it takes too long because when I put this WHERE 'consoData' clause (WHERE meteoData.consoData = 4), he returns to 0 116rows. 2 sec., to get the same output of data. If I remove the LEFT OUTER JOIN diagnosis2 (last but one line) there are also 0. 2 s.
I think that the solution would be to force "WHERE Id_compteur =... "to take effect before he joined the"diagnosis2"of the table, but do not know how to do.
The subquery takes a lot of time when to return all the lines is "meteoData.
This code is supposed to be a VIEW, so "WHERE Id_compteur =... ' will not be included in it but passed when you query the view. I tested it as a point of VIEW, same problem.
Explain the plan:
Oracle database version: 10.2.0.4.0, I'm accessing through the APEX version 4.1.1.00.23Plan hash value: 724835998 ----------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 16364 | 1342K| | 586 (4)| 00:00:08 | | 1 | TEMP TABLE TRANSFORMATION | | | | | | | | 2 | LOAD AS SELECT | DIAGNOSTIC2 | | | | | | | 3 | WINDOW SORT | | 563 | 15764 | | 12 (25)| 00:00:01 | | 4 | VIEW | V_RELEVESCORRIGES | 563 | 15764 | | 11 (19)| 00:00:01 | | 5 | SORT GROUP BY | | 563 | 56300 | | 11 (19)| 00:00:01 | | 6 | VIEW | | 563 | 56300 | | 10 (10)| 00:00:01 | |* 7 | HASH JOIN RIGHT OUTER | | 563 | 25335 | | 10 (10)| 00:00:01 | | 8 | TABLE ACCESS FULL | COMPTEURS | 22 | 132 | | 3 (0)| 00:00:01 | | 9 | VIEW | | 563 | 21957 | | 7 (15)| 00:00:01 | |* 10 | HASH JOIN OUTER | | 563 | 26461 | | 7 (15)| 00:00:01 | | 11 | TABLE ACCESS FULL | RELEVES | 563 | 12949 | | 3 (0)| 00:00:01 | | 12 | VIEW | V_CORRECTIONDATA | 563 | 13512 | | 3 (0)| 00:00:01 | |* 13 | VIEW | | 563 | 28150 | | 3 (0)| 00:00:01 | | 14 | WINDOW SORT | | 563 | 67560 | | 3 (0)| 00:00:01 | | 15 | VIEW | | 563 | 67560 | | 3 (0)| 00:00:01 | | 16 | NESTED LOOPS OUTER| | 563 | 14638 | | 3 (0)| 00:00:01 | | 17 | TABLE ACCESS FULL| RELEVES | 563 | 12949 | | 3 (0)| 00:00:01 | |* 18 | INDEX UNIQUE SCAN| COMPTEURS_PK | 1 | 3 | | 0 (0)| 00:00:01 | |* 19 | HASH JOIN RIGHT OUTER | | 16364 | 1342K| | 573 (4)| 00:00:07 | | 20 | INDEX FULL SCAN | DIAGNOSTIC2_PK | 4 | 24 | | 1 (0)| 00:00:01 | | 21 | VIEW | | 16364 | 1246K| | 572 (4)| 00:00:07 | | 22 | SORT ORDER BY | | 16364 | 1661K| 3864K| 572 (4)| 00:00:07 | |* 23 | HASH JOIN | | 16364 | 1661K| | 179 (9)| 00:00:03 | | 24 | VIEW | | 1157 | 55536 | | 3 (0)| 00:00:01 | | 25 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6657_90A96D1D | 1157 | 55536 | | 3 (0)| 00:00:01 | |* 26 | VIEW | | 7963 | 435K| | 175 (8)| 00:00:03 | | 27 | SORT GROUP BY | | 7963 | 311K| 1768K| 175 (8)| 00:00:03 | | 28 | MERGE JOIN | | 26409 | 1031K| | 23 (48)| 00:00:01 | | 29 | SORT JOIN | | 1157 | 28925 | | 4 (25)| 00:00:01 | | 30 | VIEW | | 1157 | 28925 | | 3 (0)| 00:00:01 | | 31 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6657_90A96D1D | 1157 | 55536 | | 3 (0)| 00:00:01 | |* 32 | FILTER | | | | | | | |* 33 | SORT JOIN | | 9130 | 133K| | 11 (19)| 00:00:01 | | 34 | TABLE ACCESS FULL | METEO | 9130 | 133K| | 9 (0)| 00:00:01 | ----------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 7 - access("RELEVES"."ID_COMPTEUR"="COMPTEURS"."ID"(+)) 10 - access("RELEVES"."ID_COMPTEUR"="V_CORRECTIONDATA"."ID_COMPTEUR"(+)) filter("RELEVES"."DATE_RELEVE">="V_CORRECTIONDATA"."DATE_CHANGEMENT"(+)) 13 - filter("CHG_COMPTEUR"=1 AND "ID_COMPTEUR"="ID_COMPTEUR_CORR") 18 - access("RELEVES"."ID_COMPTEUR"="COMPTEURS"."ID"(+)) 19 - access("CONSODATA"."ID_VARIABLE"="DIAGNOSTIC2"."ID_VARIABLE"(+) AND "CONSODATA"."ID_RELEVE"="DIAGNOSTIC2"."ID_RELEVE"(+)) 23 - access("RAWDATA"."ID_RELEVE"="METEODATA"."ID_RELEVE") 26 - filter("METEODATA"."ID_COMPTEUR"=4) 32 - filter("DATE_METEO">"X1") 33 - access(INTERNAL_FUNCTION("DATE_METEO")<=INTERNAL_FUNCTION("X2")) filter(INTERNAL_FUNCTION("DATE_METEO")<=INTERNAL_FUNCTION("X2"))
I hope that my question is not too blurred...Ah, sorry, I missed that bit in your original post. I had a similar problem where I was adamant that the predicate must be pushed into the view (despite the use of analytical functions - they used the conditions that would allow the predicate be pushed): http://www.orchestrapit.co.uk/?p=55
In the end, I solved my problem by using joins to inline, rather than the subquery factoring - maybe you can try to convert your view online views and see if that helps?
-
Bind variables in the SQL causes slow
We have a strange problem in our PeopleSoft system that I traced to a SELECT statement using bind variables, if hardcode us them values in SQL, it runs very fast.
but using bindings (what the application does) a problem of efficiency. I'm going to re - write the code that is based on a view of three tables joined to go against
the base tables and I don't think I'll have a problem. However, I would like to know why the problem exists in the first place. Here is what info I have:
Oracle version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
It's the 'good' application without links:
And the 'good' explains the plan:SELECT COUNT(*) FROM sysadm.PS_ERN_PROG_DESCR A WHERE A.ERN_PROGRAM = 'VT' AND A.ERNCD = '01' AND EFFDT = (SELECT MAX(B.EFFDT) FROM sysadm.PS_ERN_PROG_DESCR B WHERE B.ERN_PROGRAM = 'VT' AND B.EFFDT <= TO_DATE('2009-10-10','YYYY-MM-DD') );
Here is the 'good' autotrace:Plan hash value: 3344976101 ------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 33 | 58 (23)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 33 | | | | 2 | NESTED LOOPS | | 1 | 33 | 3 (0)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 22 | 2 (0)| 00:00:01 | |* 4 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_DEF | 1 | 12 | 1 (0)| 00:00:01 | | 5 | SORT AGGREGATE | | 1 | 9 | | | | 6 | VIEW | | 23 | 207 | 51 (26)| 00:00:01 | |* 7 | FILTER | | | | | | | 8 | SORT GROUP BY | | 23 | 1748 | 51 (26)| 00:00:01 | |* 9 | HASH JOIN | | 2995 | 222K| 49 (23)| 00:00:01 | |* 10 | TABLE ACCESS FULL | PS_EARNINGS_TBL | 1913 | 24869 | 15 (7)| 00:00:01 | |* 11 | HASH JOIN | | 13621 | 838K| 30 (20)| 00:00:01 | | 12 | TABLE ACCESS FULL | PS_EARNINGS_TBL | 1913 | 42086 | 14 (0)| 00:00:01 | |* 13 | HASH JOIN | | 3097 | 124K| 14 (29)| 00:00:01 | |* 14 | TABLE ACCESS BY INDEX ROWID| PS_ERN_PROGRAM_TBL | 9 | 207 | 2 (0)| 00:00:01 | |* 15 | INDEX RANGE SCAN | PS_ERN_PROGRAM_TBL | 18 | | 1 (0)| 00:00:01 | |* 16 | TABLE ACCESS FULL | PS_ERN_PROGRAM_DEF | 12035 | 211K| 10 (20)| 00:00:01 | |* 17 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 1 (0)| 00:00:01 | | 18 | SORT AGGREGATE | | 1 | 10 | | | |* 19 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 2 (0)| 00:00:01 | |* 20 | TABLE ACCESS BY INDEX ROWID | PS_ERN_PROGRAM_TBL | 1 | 11 | 1 (0)| 00:00:01 | |* 21 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_TBL | 1 | | 0 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"= (SELECT MAX("$vm_col_2") FROM (SELECT /*+ */ "EFFDT" "$vm_col_1","A"."EFFDT" "$vm_col_2" FROM SYSADM."PS_EARNINGS_TBL" "C",SYSADM."PS_ERN_PROGRAM_TBL" "B",SYSADM."PS_ERN_PROGRAM_DEF" "A",SYSADM."PS_EARNINGS_TBL" "D" WHERE "D"."EFFDT"<="A"."EFFDT" AND "D"."ERNCD"="C"."ERNCD" AND "D"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "A"."EFFDT"="B"."EFFDT" AND "A"."ERN_PROGRAM"="B"."ERN_PROGRAM" AND "A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "B"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "B"."ERN_PROGRAM"='VT' AND "B"."EFF_STATUS"='A' AND "C"."ERNCD"="A"."ERNCD" GROUP BY "D"."ERNCD",ROWID,ROWID,ROWID,ROWID,"A"."EFFDT","EFFDT" HAVING "EFFDT"=MAX("D"."EFFDT")) "$vm_view") AND "A"."ERNCD"='01') 7 - filter("EFFDT"=MAX("D"."EFFDT")) 9 - access("D"."ERNCD"="C"."ERNCD") filter("D"."EFFDT"<="A"."EFFDT") 10 - filter("D"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 11 - access("C"."ERNCD"="A"."ERNCD") 13 - access("A"."ERN_PROGRAM"="B"."ERN_PROGRAM" AND "A"."EFFDT"="B"."EFFDT") 14 - filter("B"."EFF_STATUS"='A') 15 - access("B"."ERN_PROGRAM"='VT' AND "B"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 16 - filter("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 17 - access("C"."ERNCD"='01') filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_EARNINGS_TBL" "D" WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B1) AND "D"."ERNCD"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B3)) 19 - access("D"."ERNCD"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B2) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B1) 20 - filter("B"."EFF_STATUS"='A') 21 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
===================================SQL> variable ppe_date varchar2(10) SQL> variable erncd varchar2(3) SQL> exec :ppe_date := '2009-10-10' SQL> exec :erncd := '01' SQL> SELECT COUNT(*) 2 FROM PS_ERN_PROG_DESCR A 3 WHERE A.ERN_PROGRAM = 'VT' 4 AND A.ERNCD = '01' 5 AND EFFDT = 6 (SELECT MAX(B.EFFDT) 7 FROM PS_ERN_PROG_DESCR B 8 WHERE B.ERN_PROGRAM = 'VT' 9 AND B.EFFDT <= TO_DATE('2009-10-10','YYYY-MM-DD') 10 ); COUNT(*) ---------- 1 Elapsed: 00:00:01.23 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=59 Card=1 Bytes=33) 1 0 SORT (AGGREGATE) 2 1 NESTED LOOPS (Cost=3 Card=1 Bytes=33) 3 2 NESTED LOOPS (Cost=2 Card=1 Bytes=22) 4 3 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=12) 5 4 SORT (AGGREGATE) 6 5 VIEW (Cost=52 Card=24 Bytes=216) 7 6 FILTER 8 7 SORT (GROUP BY) (Cost=52 Card=24 Bytes=1824) 9 8 HASH JOIN (Cost=50 Card=3177 Bytes=241452) 10 9 TABLE ACCESS (FULL) OF 'PS_EARNINGS_TBL' (TABLE) (Cost=15 Card=1921 Bytes=24973) 11 9 HASH JOIN (Cost=31 Card=14488 Bytes=912744) 12 11 TABLE ACCESS (FULL) OF 'PS_EARNINGS_TBL' (TABLE) (Cost=14 Card=1921 Bytes=42262) 13 11 HASH JOIN (Cost=15 Card=3303 Bytes=135423) 14 13 TABLE ACCESS (FULL) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=2 Card=9 Bytes=207) 15 13 TABLE ACCESS (FULL) OF 'PS_ERN_PROGRAM_DEF' (TABLE) (Cost=12 Card=12856 Bytes=231408) 16 3 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=10) 17 16 SORT (AGGREGATE) 18 17 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=2 Card=1 Bytes=10) 19 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11) 20 19 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 182 consistent gets 0 physical reads 0 redo size 232 bytes sent via SQL*Net to client 278 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 1 rows processed SQL> spool off
This is the 'bad' query using bindings:
===================================
The 'bad' explain planSELECT COUNT(*) FROM sysadm.PS_ERN_PROG_DESCR A WHERE A.ERN_PROGRAM = 'VT' AND A.ERNCD = :erncd AND EFFDT = (SELECT MAX(B.EFFDT) FROM sysadm.PS_ERN_PROG_DESCR B WHERE B.ERN_PROGRAM = 'VT' AND B.EFFDT <= TO_DATE(:ppe_date,'YYYY-MM-DD') );
Here's the bad autotrace:explain plan succeeded. PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 337039962 -------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 33 | 20 (25)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 33 | | | | 2 | NESTED LOOPS | | 1 | 33 | 3 (0)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 22 | 2 (0)| 00:00:01 | |* 4 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_DEF | 1 | 12 | 1 (0)| 00:00:01 | | 5 | SORT AGGREGATE | | 1 | 63 | | | | 6 | NESTED LOOPS | | 1 | 63 | 13 (39)| 00:00:01 | | 7 | NESTED LOOPS | | 1 | 52 | 12 (42)| 00:00:01 | |* 8 | HASH JOIN | | 4 | 168 | 12 (42)| 00:00:01 | | 9 | VIEW | VW_SQ_1 | 88 | 2112 | 9 (45)| 00:00:01 | | 10 | SORT GROUP BY | | 88 | 2728 | 9 (45)| 00:00:01 | | 11 | MERGE JOIN | | 3087 | 95697 | 7 (29)| 00:00:01 | | 12 | SORT JOIN | | 643 | 11574 | 2 (0)| 00:00:01 | |* 13 | INDEX RANGE SCAN | PS_ERN_PROGRAM_DEF | 643 | 11574 | 2 (0)| 00:00:01 | |* 14 | SORT JOIN | | 96 | 1248 | 5 (40)| 00:00:01 | |* 15 | INDEX FAST FULL SCAN | PS_EARNINGS_TBL | 96 | 1248 | 4 (25)| 00:00:01 | |* 16 | INDEX RANGE SCAN | PS_ERN_PROGRAM_DEF | 643 | 11574 | 2 (0)| 00:00:01 | |* 17 | INDEX UNIQUE SCAN | PS_EARNINGS_TBL | 1 | 10 | 0 (0)| 00:00:01 | |* 18 | TABLE ACCESS BY INDEX ROWID| PS_ERN_PROGRAM_TBL | 1 | 11 | 1 (0)| 00:00:01 | |* 19 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_TBL | 1 | | 0 (0)| 00:00:01 | |* 20 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 1 (0)| 00:00:01 | | 21 | SORT AGGREGATE | | 1 | 10 | | | |* 22 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 2 (0)| 00:00:01 | |* 23 | TABLE ACCESS BY INDEX ROWID | PS_ERN_PROGRAM_TBL | 1 | 11 | 1 (0)| 00:00:01 | |* 24 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_TBL | 1 | | 0 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"= (SELECT MAX("A"."EFFDT") FROM SYSADM."PS_EARNINGS_TBL" "C",SYSADM."PS_ERN_PROGRAM_TBL" "B",SYSADM."PS_ERN_PROGRAM_DEF" "A", (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) "VW_COL_1","D"."ERNCD" "ERNCD",ROWID "ROWID" FROM SYSADM."PS_EARNINGS_TBL" "D","PS_ERN_PROGRAM_DEF" "A" WHERE "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND "A"."ERN_PROGRAM"='VT' AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT") AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') GROUP BY "D"."ERNCD",ROWID) "VW_SQ_1" WHERE "ROWID"=ROWID AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND "A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT" AND "B"."ERN_PROGRAM"='VT' AND "B"."EFF_STATUS"='A' AND "B"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND SYS_OP_DESCEND("EFFDT")=SYS_OP_DESCEND("VW_COL_1") AND "ERNCD"="C"."ERNCD" AND "C"."ERNCD"="A"."ERNCD" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))="VW_COL_1") AND "A"."ERNCD"=:ERNCD) 8 - access("ROWID"=ROWID) 13 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 14 - access(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT")) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT")) 15 - filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 16 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 17 - access("ERNCD"="C"."ERNCD" AND SYS_OP_DESCEND("EFFDT")=SYS_OP_DESCEND("VW_COL_1")) filter("C"."ERNCD"="A"."ERNCD" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))="VW_COL_1") 18 - filter("B"."EFF_STATUS"='A') 19 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT") filter("B"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 20 - access("C"."ERNCD"=:ERNCD) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_EARNINGS_TBL" "D" WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B1) AND "D"."ERNCD"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B3)) 22 - access("D"."ERNCD"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B2) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B1) 23 - filter("B"."EFF_STATUS"='A') 24 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
SQL> variable ppe_date varchar2(10) SQL> variable erncd varchar2(3) SQL> exec :ppe_date := '2009-10-10' SQL> exec :erncd := '01' SQL> SELECT COUNT(*) 2 FROM PS_ERN_PROG_DESCR A 3 WHERE A.ERN_PROGRAM = 'VT' 4 AND A.ERNCD = :erncd 5 AND EFFDT = 6 (SELECT MAX(B.EFFDT) 7 FROM PS_ERN_PROG_DESCR B 8 WHERE B.ERN_PROGRAM = 'VT' 9 AND B.EFFDT <= TO_DATE(:ppe_date,'YYYY-MM-DD') 10 ); COUNT(*) ---------- 1 Elapsed: 00:04:07.40 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=20 Card=1 Bytes=33) 1 0 SORT (AGGREGATE) 2 1 NESTED LOOPS (Cost=3 Card=1 Bytes=33) 3 2 NESTED LOOPS (Cost=2 Card=1 Bytes=22) 4 3 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=12) 5 4 SORT (AGGREGATE) 6 5 NESTED LOOPS (Cost=13 Card=1 Bytes=63) 7 6 NESTED LOOPS (Cost=12 Card=1 Bytes=52) 8 7 HASH JOIN (Cost=12 Card=4 Bytes=168) 9 8 VIEW OF 'VW_SQ_1' (VIEW) (Cost=9 Card=88 Bytes=2112) 10 9 SORT (GROUP BY) (Cost=9 Card=88 Bytes=2728) 11 10 MERGE JOIN (Cost=7 Card=3087 Bytes=95697) 12 11 SORT (JOIN) (Cost=2 Card=643 Bytes=11574) 13 12 INDEX (RANGE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=2 Card=643 Bytes=11574) 14 11 SORT (JOIN) (Cost=5 Card=96 Bytes=1248) 15 14 INDEX (FAST FULL SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=4 Card=96 Bytes=1248) 16 8 INDEX (RANGE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=2 Card=643 Bytes=11574) 17 7 INDEX (UNIQUE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1 Bytes=10) 18 6 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11) 19 18 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1) 20 3 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=10) 21 20 SORT (AGGREGATE) 22 21 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=2 Card=1 Bytes=10) 23 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11) 24 23 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1) Statistics ---------------------------------------------------------- 3820 recursive calls 66 db block gets 4677728 consistent gets 80608 physical reads 0 redo size 232 bytes sent via SQL*Net to client 278 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 2 sorts (memory) 1 sorts (disk) 1 rows processed SQL> spool off
I think you have to hit some sort of bug in the optimizer. Do you have the histograms on the EFFDT column.
-
I can not connect on my lapto even if the password is correct. I'm getting "the political group Clinet impossible service connection access Denined.
Original title: I can not connect on my laptop even if the password is correct
HI, John Angelo2,.
Try rebooting and tapping F10 to achieve the recovery screen
You can choose to repair or restore your system
Select Restore to an earlier time
If it is impossible to do the above, use the installation start screen repair DVD
This problem is caused by your user profile/registry settings/system files corruption
Response of Mouneshawar R.
Re-create the profile or restore the file ntuser.dat from the back to the top
You can post on the Technet forum for help
How to customize the default local user profile when you prepare an image of Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2
http://support.Microsoft.com/kb/973289
Assign a mandatory user profile
http://TechNet.Microsoft.com/en-us/library/cc786301 (WS.10) .aspx
http://support.Microsoft.com/kb/307800
http://msdn.Microsoft.com/en-us/library/bb776895 (v = vs. 85) .aspx
-
EqualLogic - how to level a new table before you add to the Group
I have a new table which is v7 and I try to add a group of v8. It won't join the group due to version incompatibility. How to pass it to v8 so I can join the Group? Thank you.
Hello
Create a new group with one member. I wouldn't use the Remote Setup Wizard to do this. Who sets policy RAID that requires you to wait that ends before you can upgrade the firmware.
I would rather the serial port. Then, you need to only configure port network and the new IP group.
Once you answer the basic questions are the GrpName > cli prompt you can then transfer the kit to upgrade and update the firmware.
Once you run the "update" process and restarted the table, reconnect and make sure it is in the new revision. GrpName > show Member which will show.
The CLI run "reset" to return unit to factory reset, and you can now add in your other group.
Kind regards
Don
Maybe you are looking for
-
Download constantly 'Firefox is not responding', but I am unable to reset it.
Hello. My Firefox crashes constantly on. I get "Firefox does not. But I can't reset it. When I do, I always get the "well this embarrassing" error message.The error indicates that Firefox cannot be reset due to a tab open recently. But the only tabs
-
How to authorize my computer HP (Windows 10) accept all my itunes?
How to allow my new HP computer (Windows 10) to authorize iTunes?
-
How can I make sure that my library of music on my Ipod Classic is not lost forever, if it breaks down?
-
Forgotten password - no disc reset
I have Windows XP Home Edition and I forgot my password of the administrator account. I have no other admin account set up. Will my password be reset if I do a system restore? I hate to do anything that shuts down the computer because I'm afraid o
-
I lost my "speaker" Realtek High Definition Audio from the notification area icon. How to retrieve it?