title: Grails best way to iterate all ids of a domain class
body: <p>I have code like this:</p>
  
  <pre><code>Book.list().each {
    // real code actually does something more useful
    println "My id is " + it.id
  }
  </code></pre>
  
  <p>It strikes me as a bit of a waste that the entire object of each Book is being loaded just to access the id. There is a load() method in Grails for when you only want to operate on the ID and I'm wondering if there's an equivalent here for loading all the domain instances? Should I use HQL? Or should I just leave it as-is?</p>
  
  <p>PS: It makes me wonder whether there should be a option available to most GORM methods (finders etc) which cause it to only "load" instead of "get" the target class</p>