On Jun 8, 12:19 am, Jamie <[email protected]> wrote:
> I posted this in the CakePHP core discussion group where it was
> completely ignored (isn't it supposed to be a place to get input on
> core code decisions?), but maybe someone here is interested, since it
> has a big impact on website performance:

Most of the team are away just now - but cake already has an
insertMulti function.

>
> When saving multiple rows on the same model with saveAll(), I've
> noticed two things that have an adverse effect on performance:
>
> #1: A separate INSERT query is done for each row
> #2: A "SELECT LAST_INSERT_ID() AS insertID" query is executed after
> each INSERT
>
> Correct me if I'm wrong, but as far as I can tell there's no way to
> force saveAll() to combine the separate INSERT queries into a single
> query, and there's also no way to disable the SELECT LAST_INSERT_ID()
> query, which is basically pointless when inserting rows in bulk. In
> both my own tests and tests of others (for example, Google 
> -http://code.google.com/speed/articles/optimizing-php.html), combining
> multiple INSERT statements for the same table into one statement
> really boosts speed. Has there been any discussion amongst the core
> developers to look at changing the way this saveAll() behaviour works?
> I've identified this as a major bottleneck in one of my projects, so
> I'll probably be writing my own version of the function in any case
> (which I'll be happy to share of course!).

What is your app doing such that inserts are a "major bottleneck"?
Most likely the way fixtures are imported is something you can use
directly or as a template.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to