title: Slow SparQL query when joining two sets of URIs
body: <p>I am checking a SparQL query which is running too slow on my system. Very much simplified, the query goes like this: </p>
  
  <pre><code># The whole query takes ~20 seconds
  SELECT ?baseUri_s1 {
  
      # This takes ~1 second and returns 3000 results
      { SELECT ?baseUri_s1 {
        # Here goes some more complex business logic
        ?baseUri_s1 myOntology:hasProperty1 'myProperty1'
      } }
  
      # This takes ~0.1 seconds and returns 1 result
      { SELECT ?baseUri_s2 {
        # Here goes some more complex business logic
        ?baseUri_s2 myOntology:hasProperty2 'myProperty2'
      } }
  
      FILTER (?baseUri_s1 = ?baseUri_s2)
  }
  </code></pre>
  
  <p>So if the two inner selects take under 1 second each... Is it possible that joining a list of 3000 URIs and another list of one URI takes over 18 seconds? Am I missing something?</p>