busboy — 2012-03-13T18:07:49-04:00 — #1
Does anyone know why this relatively simply update query takes several minutes? In fact, I don't even let it finish because it takes so long. In theory, this should be updating a single record, that of user ID 110.
update users set visited = visited -1 where uID in (select uID from logins
where entryPoint = 'Registration' and uID = 110);
r937 — 2012-03-13T18:54:32-04:00 — #2
look at your subquery -- you tell it which uID you want, and then you return that uID
so you can just use
update users set visited = visited -1 where uID = 110
busboy — 2012-03-13T19:01:18-04:00 — #3
I only structured my query that way to test it first. If I had written it wrong, I only wanted it to affect one account, not several thousand. But anyway, shouldn't a query like the one I did be executed very quickly being that only one user was involved? Why did it take several minutes?
r937 — 2012-03-13T19:21:58-04:00 — #4
did you do an EXPLAIN on it?