# Dremio uses one core for processing

**URL:** <https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871>\
**Category:** Uncategorized\
**Created:** [January 10, 2020, 11:20pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871 "2020-01-10T23:20:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfarmer](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mfarmer](https://community.dremio.com/u/mfarmer)\
**Post date:** [January 10, 2020, 11:20pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/1 "2020-01-10T23:20:23Z")

</div>

So I have seen this previously too - This query did a pull from snowflake in about 18 mins and the majority of the rest of the time (before it failed with lack of disk space), it chugged away with just one core processing - This has the effect of making it much slower than snowflake.

I don’t really understand why the one core only is used - but it’s causing me real performance issues…

[c8b61204-88e1-48ab-aeae-6cc134ab9d4e.zip](https://community.dremio.com/uploads/short-url/i5Zp8cuUq0IfRkToIpsWBGxzyk0.zip) (32.2 KB)

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [January 11, 2020, 2:55pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/2 "2020-01-11T14:55:25Z")

</div>

@mfarmer

The reason we are executing on only one core is because you have only one reflection Parquet file and in that only one group which decides the number of splits which in turn decides the number of parallel threads. Number of rowgroups upto 70% of the total number of cores on that node will decide the degree of parallelism. I see you query is accelerated so when you create the reflection you need to decide on the right partition column so you get more splits, below is a best practices document for creating reflections

> **[Dremio Data Reflections Overview & Best Practices](https://www.dremio.com/lp/data-reflections-best-practices)**
>
> Data Reflections are Dremio's patented ability to accelerate queries on data from any source and any size. Download this white paper to learn about how Data Reflections work and best practices for designing and managing their use.

---

<div class="post-metadata">

**Author:** ![mfarmer](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mfarmer](https://community.dremio.com/u/mfarmer)\
**Post date:** [January 11, 2020, 3:04pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/3 "2020-01-11T15:04:08Z")

</div>

thanks for the white paper - I will read that.

You said I had one reflection parquet, but the job details show 3 - how can I tell which one causes the single core usage ?

 ![Screen Shot 2020-01-11 at 10.02.52 AM](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/e/e67e66b06b28246a87c2a3e697e8d2fb083d2658.png)

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [January 11, 2020, 9:22pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/4 "2020-01-11T21:22:01Z")

</div>

@mfarmer

There are 4 scans

1. JDBC scan for F\_STAY always single threaded
2. RAW reflection on snowflake.KLDW.PUBLIC.D\_DATE has just 1 split so single threaded
3. RAW reflection on KLDW.LOOKUP.BRAND\_COMP\_SET\_LOOKUP has just 1 split so single threaded
4. RAW reflection on snowflake.KLDW.PUBLIC.D\_PROPERTY has 23 splits so can have parallel threads but unfortunately has only 45K records and we spin up the next thread only at 100K

I just had a closer look on why your query is slow as initially you wanted to know the reason for single threaded. Your query is slow not because of the 3 reflections (#2, #3 and #4) but because of the JDBC scan #1 which is scanning 3,032,397,184 records.

If you run this SQL on the source directly, how much does it take. Preferably run it from a client installed on the Dremio Coordinator

> SELECT “OCCUPANCY\_DT\_ID”, “ROOM\_COUNT”, “KL\_TA\_CODE”, “KL\_TA\_CATEGORY\_ID”, “KL\_PROP\_ID”, “KL\_RATE\_ID”, “KL\_SOB\_ID”, “KL\_CHANNEL\_COST\_AMT”, “KL\_TRANSACTION\_COST\_AMT”, “KL\_AMENITY\_COST\_AMT”, “KL\_LOYALTY\_COST\_AMT”, “KL\_GUEST\_PAID\_REVENUE\_AMT”, “KL\_HOTEL\_COLLECTED\_REVENUE\_AMT”, “KL\_COPE\_REVENUE\_AMT”, “KL\_LOYALTY\_FLAG”, “KL\_NO\_SHOW\_FLAG”, “KL\_CANCELLATION\_FLAG”  
> FROM “KLDW”.“PUBLIC”.“F\_STAY”) AS “F\_STAY”  
> WHERE “KL\_SOB\_ID” IS NOT NULL

---

<div class="post-metadata">

**Author:** ![mfarmer](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mfarmer](https://community.dremio.com/u/mfarmer)\
**Post date:** [January 11, 2020, 10:15pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/5 "2020-01-11T22:15:36Z")

</div>

Thanks for the response. The full query direct on snowflake takes around 2.25 hrs - about an hour less then dremio.

The jdbc portion on snowflake of the dremio query takes just under 18 mins to complete.

Martin

---

<div class="post-metadata">

**Author:** ![mfarmer](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mfarmer](https://community.dremio.com/u/mfarmer)\
**Post date:** [January 11, 2020, 10:23pm UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/6 "2020-01-11T22:23:41Z")

</div>

Here’s the history from snowflake (for the portion that dremio sent it) - Note this is using a SMALL warehouse

I

 ![Screen Shot 2020-01-11 at 5.23.00 PM](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/b/bf5d60f7131fc04267d181f713b925608162a699.png)

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [January 12, 2020, 2:48am UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/7 "2020-01-12T02:48:32Z")

</div>

@mfarmer

How often does the JDBC data change? Can you create a reflection for that dataset and keep at one day refresh?

---

<div class="post-metadata">

**Author:** ![mfarmer](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mfarmer](https://community.dremio.com/u/mfarmer)\
**Post date:** [January 12, 2020, 10:15am UTC](https://community.dremio.com/t/dremio-uses-one-core-for-processing/4871/8 "2020-01-12T10:15:57Z")

</div>

It changes multiple times a day for three weeks a month.

I tried a reflection but gave in after 12 hrs of execution.

However an “unload” from snowflake only took 2 hrs and the reflection on that was pretty quick so that may be a way forward
