Re: Multiple Inserts without a loop

2013-04-18 Thread David Coll
I've just made some test populating a database with millions of rows and the difference between -save() and -saveMany() wasn't very important (~100 query/seconds vs ~125 q/sec) (on a old local server). But then I've made it work throught $this-MyModel-getDataSource()-insertMulti('MyModel',

Re: Multiple Inserts without a loop

2008-09-29 Thread Bruno Bergher
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

Re: Multiple Inserts without a loop

2008-09-29 Thread teknoid
atomic 'true', doesn't mean it's going to build the INSERT as described above, in one call. saveAll() is going to do multiple inserts, but within a transaction, which ensures data integrity. On Sep 29, 3:29 pm, Bruno Bergher [EMAIL PROTECTED] wrote: Inserting 100 records all at once will

Re: Multiple Inserts without a loop

2008-09-29 Thread Joe
You're right, multiple plain jane inserts are significantly slower than one large INSERT statement. Some quick comparisons showed a huge difference between inserting 1000 rows at once and doing each individually. There's a handful of ways to try and get around this, anything from disabling the

Re: Multiple Inserts without a loop

2008-08-21 Thread RichardAtHome
I think the 1000 was for illustration only. I'd run a few quick benchmarks to see what the real difference between 1 insert with 1000 values() and 1000 queries would be. I'm betting it wont be much... On Aug 20, 11:04 pm, teknoid [EMAIL PROTECTED] wrote: AFAIK, the syntax you are proposing is

Multiple Inserts without a loop

2008-08-20 Thread seth
So it seems most implementations of active record I've used have NOT had a way to do this, so I guess I'm hoping Cake is above the curve here... I'd like the general ability to do N record inserts (and updates) without doing N database calls. Essentially, I want something of the form: INSERT

Re: Multiple Inserts without a loop

2008-08-20 Thread teknoid
use saveAll() to store multiple records On Aug 20, 12:55 pm, seth [EMAIL PROTECTED] wrote: So it seems most implementations of active record I've used have NOT had a way to do this, so I guess I'm hoping Cake is above the curve here... I'd like the general ability to do N record inserts

Re: Multiple Inserts without a loop

2008-08-20 Thread seth
Right, but how many inserts does this perform? And does the auto- magic know to use the Exam's newly created id? -seth On Aug 20, 10:36 am, teknoid [EMAIL PROTECTED] wrote: use saveAll() to store multiple records On Aug 20, 12:55 pm, seth [EMAIL PROTECTED] wrote: So it seems most

Re: Multiple Inserts without a loop

2008-08-20 Thread teknoid
Right, but how many inserts does this perform? - As many inserts as required And does the auto-magic know to use the Exam's newly created id? - Yes On Aug 20, 5:37 pm, seth [EMAIL PROTECTED] wrote: Right, but how many inserts does this perform?  And does the auto- magic know to use the

Re: Multiple Inserts without a loop

2008-08-20 Thread seth
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? --~--~-~--~~~---~--~~

Re: Multiple Inserts without a loop

2008-08-20 Thread Chris Hartjes
On Wed, Aug 20, 2008 at 5:51 PM, seth [EMAIL PROTECTED] 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

Re: Multiple Inserts without a loop

2008-08-20 Thread teknoid
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 really insert 1001 rows? On Aug 20, 5:51 pm, seth [EMAIL PROTECTED] wrote: Right, but how many inserts does this perform? - As many inserts as required Yes, but