QamoosTech
DatabasesORM and migrationsIntermediateDjango

Bulk Operation

PronunciationBULK op-er-AY-shun

Definition

A bulk operation inserts, updates or deletes many rows with a single query, instead of sending one query per row.

Where you hear it

In ORM code, data imports, seeding scripts and performance reviews that remove slow loops.

Examples

  • Use a bulk insert for the 10,000 imported rows.
  • Saving each object in a loop sent thousands of queries; the bulk version sends one.
  • Inserting the 10,000 rows with one bulk operation took two seconds.

Common mistake

Assuming bulk methods run all your model logic. Many skip signals and custom save() code.

Don't confuse with

A transaction, which groups steps so they succeed or fail together. A bulk operation is about sending fewer queries.

Say it at work

  • In a meeting or chatSwitch that loop to a bulk insert.
  • In an email or ticketDo the import in batches of a thousand rows.