title: Django Model Optimization
body: <pre><code>Class Model(models.Model):
     .......
     .......
     .......
     .......
     first_name = models.CHarField(max_length = 50)
     last_name = models.CharField(ma_lenghth = 50)
  
     def full_name():
        return '%s %s' %(self.first_name, self.last_name)
  </code></pre>
  
  <ul>
  <li>Calling <code>Models.objects.get().full_name()</code>  would be efficient</li>
  </ul>
  
  <p>or </p>
  
  <ul>
  <li><code>Model.objects.filter().values('first_name, 'last_name')</code> and than
  adding the string later would be better.</li>
  </ul>
  
  <p>The question is in regards to database optimization. Basically I want to know if calling a method of a model loads the whole object or not. If not than I feel both would result in same database operations but if it loads the whole object than values method would be better optimization.</p>
  
  <p>Please reply. Share any experiences if you have on this topic and also any statistics for the comparison if you have one.
  Please note that this is an example and not the actual use case, the model also contains many other fields.</p>
  
  <p>Few will feel that using <code>defer()</code> or <code>only()</code> will also give the desired result. But what I found in django documentation is that it basically only prevents those fields data from being converted to python object and not in sql look-ups. Therefore I don't think that's any better.
  Please help me out
  Thanks in advance.</p>