Reference Manual :: 19 Stored Programs and Views. Reference Manual :: 5.1.4 Server System Variables. Tutorial/tutoriel/cours : SQL. Union, intersection, différence. Debugging sleeping connections with MySQL. February 8, 2007 by Peter Zaitsev30 Comments Have you ever seen connection in the SHOW PROCESSLIST output which is in “Sleep” state for a long time and you have no idea why this would happen ?
I see if frequently with web applications and it is often indication of trouble. Not only it means you may run out of MySQL connections quicker than you expected but it also frequently indicates serious problems in the application. If you do not use persistent connections and you have connection in Sleep stage for 600 seconds what could it be ? It may mean some of your pages take that long to generate (or might be the code simply gets into the tight loop and page never gets generated) it also could mean some of external Web Services are slow or not available and you’re not dealing with timeouts properly.
Or may be you have several connections to MySQL server and right now running query which takes that long ? First task is to find to which process the connection belongs. 10.1 Jeux de caractères et collation : généralités.