Django Django

What's the difference between `.save()` and `.update()`?

Dima Nov 15, 2026

Short Answer

save() is a method on a model instance you are holding; update() is a method on a queryset that never loads anything. save() writes every concrete field of that one row and runs the full model machinery on the way — your save() override, the pre_save and post_save signals, auto_now timestamps. update() compiles straight to a single UPDATE … WHERE …, changes only the columns you name across every matching row, and returns how many rows matched — without instantiating a model, calling save(), or firing a signal. That makes update() the tool for changing many rows at once, and the reason a bulk change can silently skip logic you assumed always runs.


How It Works

Model.save() starts from an object already in memory. Django knows its primary key, so it issues an UPDATE for that single row, and by default the SET clause lists every concrete field on the model — not just the ones you touched, because Python has no way to know which attributes you assigned. That is why a save() on a stale instance can quietly overwrite a column somebody else changed between your read and your write.

Around that write sits the model layer. save() is an ordinary Python method, so an override runs; pre_save and post_save are sent; a DateTimeField(auto_now=True) gets its new value in Python before the SQL is built. All of it happens per instance, which means saving a thousand rows in a loop is a thousand round trips plus a thousand passes through that machinery.

QuerySet.update() works at the other end. It takes the queryset's existing WHERE clause, adds a SET clause from the keyword arguments, and sends one statement. No rows are fetched, no model instances are constructed, and because no instance exists there is nothing for save() to be called on and nothing for a signal to carry — so neither happens. auto_now is not applied either, for the same reason: that value is computed by the field in Python, and Python never sees the row.

The return value reflects this. update() returns the number of rows the WHERE clause matched, which is the only feedback available when nothing was loaded. It is also why update() is immune to the read-modify-write race that save() invites: the database evaluates the WHERE and the SET in one statement, so no other transaction can slip between a read and a write that never existed separately.

The consequence to internalise is that they operate on different things. save() acts on your in-memory object and pushes it to the database; update() acts on the database and leaves your in-memory objects untouched and therefore stale.


Seeing It Run

These steps share a fixture. Create depot/models.py and bootstrap.py as shown in the first step, plus an empty depot/__init__.py, then replace main.py for each later step. Run with:

python3 main.py

One row and every column, versus many rows and one column

The two writes side by side, with the SQL each produces.

# depot/models.py
from django.db import models


class Shipment(models.Model):
    reference = models.CharField(max_length=20)
    status = models.CharField(max_length=20)
    weight_kg = models.IntegerField()


# bootstrap.py
import django
from django.conf import settings

settings.configure(
    DEBUG=True,
    INSTALLED_APPS=["depot"],
    DATABASES={"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}},
    DEFAULT_AUTO_FIELD="django.db.models.AutoField",
    USE_TZ=False,
)
django.setup()

from django.db import connection

from depot.models import Shipment


def seed():
    with connection.schema_editor() as editor:
        editor.create_model(Shipment)
    Shipment.objects.create(reference="SHP-4471", status="booked", weight_kg=120)
    Shipment.objects.create(reference="SHP-4408", status="booked", weight_kg=340)
    Shipment.objects.create(reference="SHP-3157", status="booked", weight_kg=90)
    connection.queries_log.clear()


# main.py
from bootstrap import Shipment, connection, seed

seed()

shipment = Shipment.objects.get(reference="SHP-4471")
shipment.status = "in-transit"
shipment.save()
print("save() wrote  :", connection.queries[-1]["sql"])

connection.queries_log.clear()
matched = Shipment.objects.filter(status="booked").update(status="in-transit")
print("update() wrote:", connection.queries[-1]["sql"])
print("rows matched  :", matched)
print("queries issued:", len(connection.queries))


save() wrote  : UPDATE "depot_shipment" SET "reference" = 'SHP-4471', "status" = 'in-transit', "weight_kg" = 120 WHERE "depot_shipment"."id" = 1
update() wrote: UPDATE "depot_shipment" SET "status" = 'in-transit' WHERE "depot_shipment"."status" = 'booked'
rows matched  : 2
queries issued: 1


save() set all three columns even though only status changed — reference and weight_kg were rewritten with the values loaded moments earlier. update() set exactly one column, across both remaining booked rows, in one statement, and reported that it matched two. Note what update() did not do: no SELECT preceded it. The count of one query is the whole cost, however many rows the filter covers.

Try it: Change shipment.save() to shipment.save(update_fields=["status"]) and predict the SET clause in the first line. It becomes UPDATE "depot_shipment" SET "status" = 'in-transit' WHERE "depot_shipment"."id" = 1: a single column, as with update(), but still for a single row, identified by its primary key. Django does not guess what you changed; it writes everything unless you tell it what to write.


update() skips the model layer entirely

Replace main.py. A post_save receiver, and the two ways of writing the same kind of change.

# main.py
from bootstrap import Shipment, seed
from django.db.models.signals import post_save
from django.dispatch import receiver

seed()


@receiver(post_save, sender=Shipment)
def announce(sender, instance, **kwargs):
    print("  post_save fired for", instance.reference)


print("instance.save():")
shipment = Shipment.objects.get(reference="SHP-4471")
shipment.status = "in-transit"
shipment.save()

print("queryset.update():")
Shipment.objects.filter(reference="SHP-4408").update(status="in-transit")
print("  (no signal fired)")


instance.save():
  post_save fired for SHP-4471
queryset.update():
  (no signal fired)


Both statements moved a shipment to in-transit, and only one of them told the rest of the application. The receiver needs an instance to hand over, and update() never built one — the row changed in the database without any Python object ever representing it. A save() override is skipped for the same reason: update() does not call save(), so nothing you put in that method runs. If a search index, an audit row, or a cache invalidation hangs off post_save, a bulk update() leaves all of it undone.


After update(), the object in your hand is stale

Replace main.py. The database changes; the instance does not.

# main.py
from bootstrap import Shipment, seed

seed()

shipment = Shipment.objects.get(reference="SHP-4471")
print("in memory before        :", shipment.status)

Shipment.objects.filter(reference="SHP-4471").update(status="delivered")
print("in memory after update():", shipment.status)
print("in the database         :", Shipment.objects.get(reference="SHP-4471").status)

shipment.refresh_from_db()
print("after refresh_from_db() :", shipment.status)


in memory before        : booked
in memory after update(): booked
in the database         : delivered
after refresh_from_db() : delivered


The update() matched the row this instance came from, and the instance still reports booked. Nothing links the two: update() addressed the database directly and has no reference to any Python object. This is dangerous in the specific case where the stale instance is saved afterwards — shipment.save() here would write status = 'booked' back over the delivered the update just set, because save() writes every column from memory. refresh_from_db() re-reads the row and is the correct step between the two.

Try it: Make the mistake the paragraph above warns about: replace the last two lines with shipment.save() and print("after a stale save() :", Shipment.objects.get(reference="SHP-4471").status). The database says delivered one line earlier; what does it say after save()? booked. The stale instance wrote all its columns from memory and silently erased the effect of update(), with no error and no warning.


Edge Cases and Gotchas

  • save(update_fields=[…]) is the middle ground. It narrows the SET clause to the named columns while keeping signals and overrides, which avoids clobbering fields you did not intend to write.
  • update() pairs naturally with F(). update(weight_kg=F("weight_kg") + 10) compiles the arithmetic into the SQL, so the database reads and writes in one statement and concurrent increments cannot lose each other.
  • You cannot update() a sliced queryset. Shipment.objects.all()[:2].update(…) raises TypeError: Cannot update a query once a slice has been taken — the WHERE clause is what identifies the rows, and a LIMIT is not part of it.
  • update() sets columns on one table only. You may filter across relations, but every keyword argument must name a field of the model itself; anything else raises FieldDoesNotExist.
  • auto_now fields are not touched by update(). A modified_at column that updates itself on save() will silently keep its old value, so include it explicitly in the update() call.

Summary

save() pushes one in-memory object to the database through the full model layer; update() sends one SQL statement against many rows and bypasses that layer completely. Choosing between them is choosing whether the model machinery should run and whether your in-memory objects stay meaningful.

  • save() writes every concrete field of a single row and runs overrides, signals, and auto_now; update() writes only the named columns and runs none of them.
  • update() issues exactly one query regardless of how many rows match, and returns the number matched rather than any object.
  • Because update() never loads a row, it has no read-modify-write window and is the safe way to change a value based on its current one, especially with F().
  • An instance held in memory is not updated by update(); saving it afterwards can overwrite the change, so call refresh_from_db() first.
  • Reach for save(update_fields=[…]) when you want a narrow write but still need signals and overrides to run.

You need to be logged in to access the cloud lab.

Log in