# Multi-threading to the “combine” function

**URL:** <https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783>\
**Category:** Performance\
**Tags:** multithreading, dataframes, piping\
**Created:** [September 7, 2021, 1:21am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783 "2021-09-07T01:21:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bojusemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bojusemo/32/26969_2.png) [@bojusemo](https://discourse.julialang.org/u/bojusemo)\
**Post date:** [September 7, 2021, 1:21am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783/1 "2021-09-07T01:21:14Z")

</div>

Hello folks,

Could anybody guide me, please?

Can multi-threading be designated to the “combine” function in the example below?

Thank you in advance

Boris

```julia
julia> begin 
           using DataFrames, Chain
           df1 = DataFrame(a = [1, 2], b = [3, 4])
           df2 = DataFrame(c = [5, 6], d = [7, 8])
           function analyze(df1, df2)
               DataFrame(x = first(df1.a), y = first(df2.c))
           end
           @chain df1 begin 
               groupby(:a)
               combine(_) do sdf1
                   analyze(sdf1, df2)
               end
           end
       end

```

---

<div class="post-metadata">

**Author:** ![bojusemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bojusemo/32/26969_2.png) [@bojusemo](https://discourse.julialang.org/u/bojusemo)\
**Post date:** [May 20, 2022, 8:40am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783/2 "2022-05-20T08:40:22Z")

</div>

No clue?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 20, 2022, 8:48am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783/3 "2022-05-20T08:48:16Z")

</div>

See

> [@Threading support for DataFrames transforms](https://discourse.julialang.org/t/threading-support-for-dataframes-transforms/79875/2):
>
> If the transformation is thread-safe it would be safe and design is made to ensure this is done the way you want in the future. For GroupedDataFrame we currently use multi-threading already for a sequence of operations. The reason is that usually operations on GroupedDataFrame are more expensive so it was a higher priority to parallelize them. combine under the hood does not differ from transform or select. It is parallelized for GroupedDataFrame but sequential for AbstractDataFrame. Con…

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [May 20, 2022, 9:58am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783/4 "2022-05-20T09:58:03Z")

</div>

in general if you tagged your question with #Data it would be probably answered earlier as this is where such questions are typically tracked. Thank you!

---

<div class="post-metadata">

**Author:** ![bojusemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bojusemo/32/26969_2.png) [@bojusemo](https://discourse.julialang.org/u/bojusemo)\
**Post date:** [May 20, 2022, 10:14am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783/5 "2022-05-20T10:14:17Z")

</div>

Thanks @bkamins, I’ll do it

---

<div class="post-metadata">

**Author:** ![bojusemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bojusemo/32/26969_2.png) [@bojusemo](https://discourse.julialang.org/u/bojusemo)\
**Post date:** [May 20, 2022, 10:15am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783/6 "2022-05-20T10:15:43Z")

</div>

> [@bkamins](#):
>
> tagged your question with #data

Thank you so much @nilshg
