parallelize an oracle sql query

My request sounds like this: Display sellers and buyers in your city with a rating of more than 100.

SELECT *
FROM Sal outer 
WHERE EXISTS (SELECT * FROM Cust inner WHERE outer.snum = inner.snum AND rating > 100); 

But according to the task I need to parallelize it, tell me how to do it? I tried this option, but it doesn't work

SELECT /*+ FULL(hr_emp) PARALLEL(hr_emp, 2) */ SNUM
FROM Sal outer hr_emp;
WHERE EXISTS (SELECT * FROM Cust inner WHERE outer.snum = inner.snum AND rating > 100); 

contents of the CUST table: enter image description here

contents of the SAL table: enter image description here

Upvotes: 0

Views: 412

Answers (1)

Littlefoot
Littlefoot

Reputation: 142705

Parallel hint is described in documentation.

  • it looks as if you copy/pasted some code from who-knows-where, hoping it'll automagically work
  • full (hr_emp) hint? Where did hr_emp come from and what does it have to do with your case?
  • outer? Sounds like outer join, but you used it as a table alias in the 1st select you posted, while its usage in the 2nd is completely invalid.

It would probably help if you posted sample data (create table and insert into statements) as well as desired output, as it is quite difficult to guess what you really have.


After you edited the question, then your query might look like this:

select /*+ parallel (2) */
  c.cnum, c.cname, c.rating, s.sname
from cust c join sal s on s.snum = c.snum
where c.rating > 100;

Upvotes: 3

Related Questions