# How to force join pushdown?

**URL:** <https://community.dremio.com/t/how-to-force-join-pushdown/6535>\
**Category:** Uncategorized\
**Created:** [November 4, 2020, 8:38am UTC](https://community.dremio.com/t/how-to-force-join-pushdown/6535 "2020-11-04T08:38:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfedyanin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/tfedyanin/32/2682_2.png) [@tfedyanin](https://community.dremio.com/u/tfedyanin)\
**Post date:** [November 4, 2020, 8:38am UTC](https://community.dremio.com/t/how-to-force-join-pushdown/6535/1 "2020-11-04T08:38:29Z")

</div>

Hello!  
I have one data source (Greenplum through PostgreSQL connector) and multiple datasets over it.

I join these datasets and the result contains only 8 rows. One of these datasets is fact and contains 160k rows.  
And Dremio downloads all data before joining:

```
Input
Input Bytes:	11.70 MB
Input Records:	168,280

Output
Output Bytes:	164 B	
Output Records:	8	

```

And the query plan consists of reading data by 97%.

I wrote pure PostgreSQL query analog (join in the database, return the only result) and it works 10x faster.

So my question - how to push down join? (I can’t use external query because of multiple virtual datasets).

[57f2076e-f31b-4be4-bb7a-9f07814f7a02.zip](https://community.dremio.com/uploads/short-url/u8gTthVv3HvXfT0vWm2lpVZ1Wmf.zip) (70.4 КБ)

---

<div class="post-metadata">

**Author:** ![tfedyanin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/tfedyanin/32/2682_2.png) [@tfedyanin](https://community.dremio.com/u/tfedyanin)\
**Post date:** [November 4, 2020, 8:53am UTC](https://community.dremio.com/t/how-to-force-join-pushdown/6535/2 "2020-11-04T08:53:55Z")

</div>

> [@Join tables from same data source](https://community.dremio.com/t/join-tables-from-same-data-source/6151):
>
> Hello, I’ve been trying to join multiple tables from the same SQL data source (MySQL). However Dremio does a complete table scan and then performs the join locally rather than pushing down the joins. Is that expected or is there a way around this? Thanks

Something similar.

---

<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:** [November 4, 2020, 6:11pm UTC](https://community.dremio.com/t/how-to-force-join-pushdown/6535/3 "2020-11-04T18:11:44Z")

</div>

@tfedyanin

We have introduces external query, where you can push down the entire query to the souce in the exact manner you want, kindly let us know, if that helps

> **[Querying External Data Sources · Dremio](https://docs.dremio.com/data-sources/external-queries.html)**

---

<div class="post-metadata">

**Author:** ![tfedyanin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/tfedyanin/32/2682_2.png) [@tfedyanin](https://community.dremio.com/u/tfedyanin)\
**Post date:** [November 6, 2020, 10:09am UTC](https://community.dremio.com/t/how-to-force-join-pushdown/6535/4 "2020-11-06T10:09:05Z")

</div>

@balaji.ramaswamy Thanks, I know, but it not applicable in this case. We use VDS in queries and these queries write many different analysts.

---

<div class="post-metadata">

**Author:** ![tfedyanin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/tfedyanin/32/2682_2.png) [@tfedyanin](https://community.dremio.com/u/tfedyanin)\
**Post date:** [November 6, 2020, 9:32pm UTC](https://community.dremio.com/t/how-to-force-join-pushdown/6535/5 "2020-11-06T21:32:17Z")

</div>

I upgraded to version 4.9.1 and the problem disappeared.
