Yii Framework Forum: batch save and update to increase performance - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

batch save and update to increase performance Rate Topic: -----

#1 User is offline   yiibie 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 06-July 12

Posted 09 August 2012 - 02:39 PM

So far I have found no built-in possibility to do a batch insert or update.
If you add just 1 item per request it is OK as it is, but if you want to update many more you will have performance problems, just imagine a shop, that imports a product list in a loop...

I think that it should be possible to implement something like this using the SQL options like INSERT INTO (a,b) VALUES (c,d),(e,f),(g,h) etc.

Furthermore such an option could be used for the HAS_MANY or MANY_MANY relations, so that you can add many comments to a post and save all in one query.

Maybe the basis of these functionalities can be build in DAO, so that non-AR-users can use them, too.
1

#2 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 966
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 10 August 2012 - 01:49 AM

checkout AR docs

http://www.yiiframew.../en/database.ar
0

#3 User is offline   yiibie 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 06-July 12

Posted 10 August 2012 - 02:29 AM

View Postalirz23, on 10 August 2012 - 01:49 AM, said:


If you thought of updateAll() I believe it is not what I am searching for, I want to save an array of complete AR models in one query.
0

#4 User is offline   yiibie 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 06-July 12

Posted 19 August 2012 - 07:56 AM

See:
https://github.com/y...yii/issues/1255
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users