Search code examples
mysqlparallel-processingpartitioning

Can MySQL parallelize UNION subqueries (or anything at all)?


I use a partitioned table with a large amount of data. According to MySQL docs, it is on the ToDo list that:

Queries involving aggregate functions such as SUM() and COUNT() can easily be parallelized.

... but, can I achieve the same functionality using UNION subqueries? Are they parallelized, or do I have to create a multithreaded client to run concurrent queries with all the possible partition keys?


Edit:

The question is not strictly about UNION or subqueries. I would like to utilize as many cores as possible for my queries. Is there any way to do this (and make sure it's done) without paralellizing my application?

Any good documentation about MySQL's current parallelizing capabilities?


Solution

  • As far as I know, currently the only way to use more than one thread/core to run queries in your application, is to use more than one connection. This of course makes it impossible to run parallel queries that are part of a single transaction.