On Fri, Apr 06, 2001 at 10:16:46AM -0400, Johnson, Gregert wrote:
> What would really help would be to use multiple row inserts, i.e.
>
> INSERT INTO speed1 VALUES (a,b,c),(d,e,f),(g,h,I),...
>
> So, prepare a series of inserts, each with a few hundred (or even thousand) row
>value sets.
In that case the benefit probably swings the other way and I wouldn't
bother with placeholders when generating insert statements for very
large numbers of rows. But it's obviously not portable and it's hard to
know which rows have failed if any do.
Tim.
> --Greg Johnson
>
> -----Original Message-----
> From: Martin Hubert [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 06, 2001 9:52 AM
> To: Tim Bunce; Heikki Tuuri
> Cc: [EMAIL PROTECTED]; FileCopyMartin
> Subject: RE: Mysql speed :)
>
> But does that really change anything on the database server side ?
> In other words is MySQL doing anything with respect to using prepared
> statements ?
>
> -----Original Message-----
> From: Tim Bunce [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 06, 2001 3:01 AM
> To: Heikki Tuuri
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Mysql speed :)
>
>
> On Thu, Apr 05, 2001 at 07:50:24PM +0300, Heikki Tuuri wrote:
> >
> > for ($j = 0; $j < 100000; $j = $j + 1) {
> >
> > $dbh->do("insert into speed1 values ($j, $j, $j)");
> > }
>
> That would run faster if you do a prepare with placeholders outside
> the loop and then just use $sth->execute($j, $j, $j) inside.
>
> That would save you the DBI statement handle creation/destruction
> overhead that you're paying for each insert when using do().
>
> Tim.
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
><[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php