Enabling parallel SQL
In the recent past, we have seen the passage from the megahertz era to the multi-core era in microprocessor design. Even laptops and small devices have multi-core CPUs available that can take advantage of applications accomplishing work in parallel.
In this recipe we will see how to enable parallel execution of queries to speed them up.
Getting ready
To observe a performance gain in this recipe, we obviously need a machine with a minimum of two cores. A single-core machine, using parallel SQL execution leads to a dip in performance when compared to using normal sequential execution.
How to do it...
In this recipe, we will use a query that returns about 1 million records. To avoid displaying this huge amount of data in our terminal, we will need to copy the code in a SQL script file, naming it TEST.SQL
, for example, and then execute it using the @
operator from SQL*Plus:
@TEST.SQL
For clarity, the content of the script is split into the following steps:
Connect to the database...