Monday, September 29, 2008

Re: Multiple Inserts without a loop

Inserting 100 records all at once will always be better regarding data
consistency.

If something wrong happens with the DB server between two calls, how
you you tell the application where to pick up next?

By inserting them all at one (usgin Model::saveAll()) with the
'atomic' property set to the default of 'true' you won't have to worry
about this. And the performance will certainly be much better,
specially if the DB and Web servers are two different machines,
perhaps in different locations.

Best,

Bruno


On 21 ago, 08:22, RichardAtHome <richardath...@gmail.com> wrote:
> I think the 1000 was for illustration only.
>
> I'd run a few quick benchmarks to see what the real difference between
> 1insertwith 1000 values() and 1000 queries would be. I'm betting it
> wont be much...
>
> On Aug 20, 11:04 pm, teknoid <teknoid.cake...@gmail.com> wrote:
>
> > AFAIK, the syntax you are proposing is MySQL (or at least DB vendor)
> > specific.
> > So, it won't be supported by cake.
>
> > And do you reallyinsert1001 rows?
>
> > On Aug 20, 5:51 pm, seth <sethsyb...@gmail.com> wrote:
>
> > > > > Right, but how many inserts does this perform?
>
> > > > - As many inserts as required
>
> > > Yes, but my whole point is that if you are inserting 1000 questions,
> > > this could be done in 2 interests or 1001... Is cake currently smart
> > > enough to do it in 2?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: