Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Ervin.

Asked: February 01, 2007 - 4:45 pm UTC

Last updated: February 02, 2007 - 2:54 pm UTC

Version: 8i,9i,10g

Viewed 1000+ times

You Asked

Tom, I would like to know when do i know when to use parallel query. i read many article in this site but sometimes i find it hard to find out when i should use parallel feature such as hints. can you give me an example? what should i watch out for when using parallel feature and when to use it?

also, i read on this site that you are coming with a new book which i cannot wait to get my hands on it. when is it coming out?
thanks

and Tom said...

Well, I covered this precise topic in my current book! Expert Oracle Database Architecture (the next book will be out the day after a finish it :)

<quote src=Expert Oracle Database Architecture>
When to Use Parallel Execution

Parallel execution can be fantastic. It can allow you to take a process that executes over many hours or days and complete it in minutes. Breaking down a huge problem into small components may, in some cases, dramatically reduce the processing time. However, one underlying concept that it will be useful to keep in mind while considering parallel execution is summarized by this very short quote from Practical Oracle8i: Building Efficient Databases (Addison-Wesley, 2001) by Jonathan Lewis:

PARALLEL QUERY option is essentially nonscalable.

Parallel execution is essentially a nonscalable solution. It was designed to allow an individual user or a particular SQL statement to consume all resources of a database. If you have a feature that allows an individual to make use of everything that is available, and then allow two individuals to use that feature, you¿ll have obvious contention issues. As the number of concurrent users on your system begins to overwhelm the number of resources you have (memory, CPU, and I/O), the ability to deploy parallel operations becomes questionable. If you have a four-CPU machine, for example, and on average you have 32 users executing queries simultaneously, then the odds are that you do not want to parallelize their operations. If you allowed each user to perform just a ¿parallel 2¿ query, then you would now have 64 concurrent operations taking place on a machine with just four CPUs. If the machine were not overwhelmed before parallel execution, it almost certainly would be now.

In short, parallel execution can also be a terrible idea. In many cases, the application of parallel processing will only lead to increased resource consumption, as parallel execution attempts to use all available resources. In a system where resources must be shared by many concurrent transactions, such as an OLTP system, you would likely observe increased response times due to this. It avoids certain execution techniques that it can use efficiently in a serial execution plan and adopts execution paths such as full scans in the hope that by performing many pieces of the larger, bulk operation in parallel, it would be better than the serial plan. Parallel execution, when applied inappropriately, may be the cause of your performance problem, not the solution for it.

So, before applying parallel execution, you need the following two things to be true:

* You must have a very large task, such as the full scan of 50GB of data.

* You must have sufficient available resources. Before parallel full scanning 50GB of data, you would want to make sure that there is sufficient free CPU (to accommodate the parallel processes) as well as sufficient I/O. The 50GB should be spread over more than one physical disk to allow for many concurrent read requests to happen simultaneously, there should be sufficient I/O channels from the disk to the computer to retrieve the data from disk in parallel, and so on.

If you have a small task, as generally typified by the queries carried out in an OLTP system, or you have insufficient available resources, again as is typical in an OLTP system where CPU and I/O resources are often already used to their maximum, then parallel execution is not something you¿ll want to consider. So you can better understand this concept, I present the following analogy.

</quote>

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Distributed Database

raspina saadi, July 25, 2010 - 2:15 am UTC

hi,
I look 4 book about Distributed Database,Parallel Query,Query Processing in Distributed Database and etc.
thanks.