mysql - Single row UPDATE query in SQL takes more than 3 seconds -


update `productdata`.`productlist`     set  `datelastupdated` = curdate(),           `totalreviews` = 100     `productlist`.`name` = 'firstchefproultrasharpdualjuliennepeelervegetablepeelerstainless'; 

this query takes 2.93 seconds , affects single row.

the table ~75k rows long. don't have experience in sql, there better way this? updating single row shouldn't take long

i'm using latest version of sql on ubuntu server

if need more information ask , i'll add post.

thanks

edit:

i didn't know sql , mysql different things.

the select statement

select * `productlist` `productlist`.`name` = 'firstchefproultrasharpdualjuliennepeelervegetablepeelerstainless'; 

takes 2.88 seconds, guess problem index.

edit:

thankyou help

when try create index on name says this:

error 1170 (42000): blob/text column 'name' used in key specification without key length 

edit:

switched name varchar(64)

its faster now

thanks everyone

  1. either create index on name column (as written in comments), or
  2. use indexed column in where statement, e.g. product id if table contains that.

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -