# Edge filter based query taking a long time to evaluate

**URL:** <https://discuss.dgraph.io/t/edge-filter-based-query-taking-a-long-time-to-evaluate/4210>\
**Category:** Dgraph\
**Created:** [March 18, 2019, 6:10pm UTC](https://discuss.dgraph.io/t/edge-filter-based-query-taking-a-long-time-to-evaluate/4210 "2019-03-18T18:10:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hbarthwal](https://avatars.discourse-cdn.com/v4/letter/h/46a35a/32.png) [@hbarthwal](https://discuss.dgraph.io/u/hbarthwal)\
**Post date:** [March 18, 2019, 6:10pm UTC](https://discuss.dgraph.io/t/edge-filter-based-query-taking-a-long-time-to-evaluate/4210/1 "2019-03-18T18:10:53Z")

</div>

I have a query for getting all german listings of US issuers as follows:

```auto
{
  german_listings_for_us_issuers(func: has(isIssuerOf)) @filter(eq(region, "US")) @normalize {
    isIssuerOf {
      listsIn @filter(eq(region, "DE")) {
        entity_id : entity_id
      }
    }
  }
}

```

Here is the schema for `isIssuerOf`

```auto
<isIssuerOf>: uid @reverse .

```

The above query takes more than 30 seconds to come back with results. However, if I change that `has` clause to use `Entity.PVT` (a predicate that I have added as per the recommendation [here](https://docs.dgraph.io/howto/#giving-nodes-a-type)) then it takes 5-10 seconds to evaluate despite the fact that there are 10 times more nodes that match this predicate. Am I doing something wrong here? How do we typically filter nodes based on the edges?

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 19, 2019, 2:36am UTC](https://discuss.dgraph.io/t/edge-filter-based-query-taking-a-long-time-to-evaluate/4210/2 "2019-03-19T02:36:40Z")

</div>

I would recommend you to use eq in root and facet in the nested blocks.

```auto
{
  german_listings_for_us_issuers(func: eq(region, "US") )
   @filter(has(isIssuerOf)) @normalize {
    isIssuerOf {
      listsIn @facets(eq(region, "DE")) {
        entity_id : entity_id
      }
    }
  }
}

```

As facets are not first-class citizen. They don’t use a lot of resource, so they can perform better. If you need it so.
