Afficher un message
Vieux 21/09/2007, 06h59   #8
Martijn Tonies
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: adding LIMIT 1 to improve performance?


"Aaron Saray" <102degrees@102degrees.com> wrote in message
news:1190347157.908675.66140@y42g2000hsy.googlegro ups.com...
> On Sep 20, 3:31 am, "Martijn Tonies" <m.ton...@upscene.removethis.com>
> wrote:
> > > > Before you do, what makes you think that adding LIMIT 1 to a
> > > > statement that searches the rows to modify by PRIMARY KEY!!
> > > > value would become any faster?

> >
> > > as I said, I noticed phpmyadmin does that, so I got this doubt and
> > > asked here (since it's not mentioned in the docs, AFAIK)

> >
> > It's probably just a standard thing PHPMyAdmin does for all table
> > updates, even the ones without a PK, to ensure only 1 row gets
> > updated.
> >

> As a force of habit, I tend to do limit x (usually 1) if I'm executing
> an update or a delete simply for the fact that I might accidentally
> create a sql statement that modifies more items than I wanted to by
> accident. Just a thought.


If your SQL statement affects more rows (meaning: your WHERE
statement is faulty) and you only want to modify 1, how do you know
which row is going to be affected if you use the LIMIT clause?


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


  Réponse avec citation
 
Page generated in 0,05241 seconds with 9 queries