> -----Original Message-----
> From: Andrés Tello [mailto:mr.crip...@gmail.com]
> Sent: May 12, 2012 10:08 AM
> To: mysql
> Subject: Mysql is toying me... why sometimes an insert or update can be
> slow!? I getting bald cuz this
> 
> While doning a batch process...
> 
> show full processlist show:
> 
> | 544 | prod | 90.0.0.51:51262 | tmz2012 | Query   |    6 |
> end                          | update `account` set `balance`= 0.00 +
> '-4000' where accountid='2583092'
> 
> No other process, lo locking no nothing...
> 
> so you take this same query... run it isolated, and the mu....fu... is
> just...f.... fast!!!!!
> 
> 
> update `account` set `balance`= 0.00 + '-4000' where accountid='2583092'
> Query OK, 0 rows affected (0.00 sec)
> Rows matched: 1  Changed: 0  Warnings: 0
> 
> 
> ARRRG!  I have seen this type of query take as long as 100+ seconds.. and
I
> don't have a F*** clue...
> 

2 things come to mind here...

1)  indexes could not be set, so it may cause huge slowdowns on bigger
tables

2)  it could have been fast because of query caching, so it may have cached
the "index" you were updating for, which may make it work fast.  Also, if
you run it manually, the first time may be slow, and subsequent attempts are
faster (again, caching)

I may be wrong here, but something to check out.

Try this:

Explain SELECT * FROM `account` WHERE accountid='2583092';

That will tell you what indexes it is using, if any


Steve


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to