Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I parallelise a simple SELECT query?

Say I have the classic:

select * from employees where dob < to_date('10/10/1985', 'DD/MM/YYYY');

The table is huge, so I want to parallelise this query.

Going by what I can see here:

http://docs.oracle.com/cd/B10500_01/server.920/a96524/c20paral.htm#13255

Essentially what we're wanting to do is arbitarily chop the table into n parts, and run our select statement on each chunk on a different thread, then join them together at the end.

  1. Is parallelisation appropriate here?
  2. How would I write the query?
like image 277
dwjohnston Avatar asked Sep 16 '25 01:09

dwjohnston


1 Answers

Try this:

select /*+ PARALLEL(4) */ * from employees 
where dob < to_date('10/10/1985', 'DD/MM/YYYY');

See more from Oracle Hint.

See also this answer to see why PARALLEL did not applied on your SQL statement.

like image 118
MinhD Avatar answered Sep 18 '25 16:09

MinhD