Opened 5 years ago

Last modified 4 weeks ago

#29771 assigned Cleanup/optimization

Support database-specific syntax for bulk_update

Reported by: Tom Forbes Owned by: Akash Kumar Sen
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Tom Forbes, Brillgen Developers, Srinivas Reddy Thatiparthy, Adam Johnson, Shai Berger, Akash Kumar Sen, John Speno Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


As Simon points out here ( specialized syntax can massively speed up bulk_update().

Postgres supports using UPDATE ... FROM ( and we can possibly emulate this with MySQL and UNION ...'s.

Change History (11)

comment:1 Changed 5 years ago by Simon Charette

Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by Tom Forbes

Owner: changed from nobody to Tom Forbes
Status: newassigned

comment:3 Changed 5 years ago by Tom Forbes

Cc: Tom Forbes added

I think the groundwork to this is quite difficult to lay. The current SQLUpdateCompiler is not suitable for this, I think.

Also I believe we can mimic this on SQLLite:

SET name=(select id from test where
WHERE id IN (select id from test)

Whether or not this is faster is something I'm not sure of. I believe the MySQL syntax will be faster, and there is no SQL standard way of doing this (I believe?), so we are left with a number of pretty different workarounds. I'm not sure how to structure this nicely.

I can maybe hack Postgres support into the SQLUpdateCompiler, but it's really not nice. We have to create all the aliases ourselves, manage the different column names, etc etc.

comment:4 Changed 5 years ago by Brillgen Developers

Cc: Brillgen Developers added

comment:5 Changed 5 years ago by Srinivas Reddy Thatiparthy

Cc: Srinivas Reddy Thatiparthy added

comment:6 Changed 4 years ago by Adam Johnson

Cc: Adam Johnson added

comment:7 Changed 4 years ago by Shai Berger

Cc: Shai Berger added

comment:8 Changed 9 months ago by Mariusz Felisiak

Owner: Tom Forbes deleted
Status: assignednew

comment:9 Changed 2 months ago by Akash Kumar Sen

Cc: Akash Kumar Sen added

comment:10 Changed 8 weeks ago by Akash Kumar Sen

Owner: set to Akash Kumar Sen
Status: newassigned

comment:11 Changed 4 weeks ago by John Speno

Cc: John Speno added
Note: See TracTickets for help on using tickets.
Back to Top