title: Load only the data that's needed from database with Graphql
body: <p>I'm learning graphql and I think I've spot one flaw in it.
  Suppose we have schema like this</p>
  
  <pre><code>type Hero {
    name: String
    friends: [Person]
  }
  
  type Person {
    name: String
  }
  </code></pre>
  
  <p>and two queries</p>
  
  <pre><code>{
    hero {
      name
      friends {
        name
      }
    }
  }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>{
    hero {
      name
    }
  }
  </code></pre>
  
  <p>And a relational database that have two corresponding tables <code>Heros</code> and <code>Persons</code>.</p>
  
  <p>If my understanding is right I can't resolve this queries such that for the first query the resulting sql query would be</p>
  
  <pre><code>select Heros.name, Persons.name
  from Heros, Persons
  where Hero.name = 'Some' and Persons.heroid = Heros.id
  </code></pre>
  
  <p>And for the second</p>
  
  <pre><code>select Heros.name, Persons.name from Heros
  </code></pre>
  
  <p>So that only the fields that are really needed for the query would be loaded from the database.</p>
  
  <p>Am I right about that?
  Also if graphql would have ability to return only the data that's needed for the query, not the data that's valid for full schema I think this would be possible, right?</p>