# models.py
from django.db import models
class Person(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30
Yes. If there are millions of records in the database then this probably isn't the best approach, but since you have to go through all many millions of the records, then pretty much no matter what you do, your DB is going to get hit pretty hard.
Here are some alternatives, none of which I'd call "better", just different.
./manage.py my_task a would update all the records where the last name starts with "a". Obviously you'd have to run this several times to get through the whole databaseKeep in mind that the .save() is going to be the harder "hit" to the database then actually selecting the millions of records.