Re: Is there a solution to this?
Not to bash MySQL -- because it really is a nice database for being FREE -- but this is the kind of thing that puts MySQL in a bad light relative to "real" databases like Oracle or even SQL Server.
If I issue a query against a database, it should either (a) do the work and give me the answer, or (b) throw an error. It should NOT hang indefinitely under ANY circumstances. Nor should it take DAYS to finish a relatively simple query. The fact that this thread was created THREE YEARS AGO is pretty damning. This should be fixed by now.
Just to forestall any comments to the affect, "Well, if you just turn this dial so, and then set this switch however, then it won't hang," the database shouldn't hang regardless of how badly I maul my setup parameters. Do you think I ever have to worry about this kind of thing with SQL Server? Never.
For those of you looking for some hint as to what's going on, here's a little bit of help:
(1) SHOW PROCESSLIST will tell you at a very high level what the process is actually doing. But if you've found this thread, you know that already.
(2) On Windows Server, the temporary table is being written to the C:\Windows\Temp folder, with a name like "#sql_*.MYD". If you're patient, you can watch just how S-L-O-W-L-Y MySQL writes this table. I have no idea what kind of algorithm could possibly take this long.
For instance, I have a query that's been running for 3 hours and has only managed to write 45MB to the temporary table (and no indexes yet). I can copy the entire temporary table in 15 seconds, so the process definitely isn't I/O bound. The process is using almost ZERO CPU, so it's definitely not CPU bound. I guess the process must be memory bound, but MySQL is using a GIG of RAM, so it could have built that entire result table in memory without any problem. The performance really is pretty sad.
In the realm of workarounds, we've had decent success breaking the job into smaller pieces and then running them all sequentially. Of course, you have no way of knowing when you'll need to do this until you've tried the full query first and seen it hang. Sad, sad, sad.
Edited 1 time(s). Last edit at 11/14/2008 12:35AM by Robert Freeland.
Subject
Views
Written By
Posted
27579
August 11, 2005 11:25AM
23653
August 12, 2005 09:07AM
18952
August 12, 2005 01:06PM
18427
August 22, 2005 09:46AM
16531
August 24, 2005 03:27PM
12982
August 24, 2005 04:05PM
13671
August 26, 2005 11:02AM
7449
August 26, 2005 11:05AM
6836
August 26, 2005 11:45AM
6613
August 26, 2005 05:46PM
6878
August 26, 2005 10:34PM
6488
August 25, 2005 01:08PM
5883
August 26, 2005 11:07AM
5689
August 27, 2005 09:09AM
6009
August 29, 2005 11:50AM
5928
August 29, 2005 12:04PM
5290
August 29, 2005 12:55PM
5175
August 29, 2005 05:26PM
5146
August 29, 2005 06:34PM
4782
August 29, 2005 08:40PM
4663
August 29, 2005 08:47PM
4528
August 29, 2005 09:00PM
4723
August 30, 2005 10:05AM
4605
August 30, 2005 10:18AM
5116
August 30, 2005 10:20AM
6124
August 29, 2005 08:53PM
4992
August 29, 2005 09:50PM
4829
August 29, 2005 10:01PM
5275
August 30, 2005 08:53AM
4687
August 30, 2005 11:22AM
5228
August 30, 2005 11:33AM
4893
August 30, 2005 11:59AM
24354
August 31, 2005 02:32PM
6526
August 31, 2005 02:49PM
5210
August 31, 2005 02:56PM
5063
August 31, 2005 03:06PM
8306
December 07, 2006 10:30AM
5003
August 31, 2005 03:10PM
4876
August 31, 2005 03:32PM
17715
August 31, 2005 07:15PM
5121
September 01, 2005 03:05AM
7835
September 15, 2005 04:31PM
5560
September 01, 2005 04:39AM
4462
September 08, 2005 09:53AM
4824
September 08, 2005 11:25AM
4597
September 26, 2005 11:52AM
4509
September 26, 2005 12:13PM
4440
September 27, 2005 09:55AM
4226
September 27, 2005 10:18AM
4125
September 28, 2005 10:29AM
4269
September 28, 2005 10:34AM
4444
September 28, 2005 10:52AM
4901
September 28, 2005 10:58AM
9678
September 23, 2005 01:56AM
4962
September 23, 2005 07:11AM
4940
October 05, 2005 04:58AM
5208
October 05, 2005 04:52PM
6151
October 05, 2005 11:49PM
5406
October 06, 2005 01:34AM
6722
October 06, 2005 04:57PM
4653
December 13, 2005 10:28AM
4638
December 13, 2005 10:34AM
4552
November 17, 2005 09:39AM
4906
January 08, 2007 12:12PM
4780
December 12, 2005 02:13PM
4624
December 14, 2005 11:43PM
4214
December 15, 2005 08:37AM
4290
December 15, 2005 11:18AM
4210
December 15, 2005 11:27AM
4323
December 15, 2005 11:32AM
4073
December 15, 2005 11:43AM
4037
December 15, 2005 11:43AM
4209
December 15, 2005 11:48AM
4092
December 15, 2005 11:51AM
4485
December 15, 2005 02:14PM
4138
December 15, 2005 02:18PM
4013
December 15, 2005 02:27PM
4515
December 15, 2005 02:43PM
4054
December 15, 2005 08:46AM
5047
January 26, 2006 12:38PM
4171
January 26, 2006 01:48PM
4246
January 26, 2006 01:48PM
4034
January 26, 2006 01:52PM
4177
January 27, 2006 04:46PM
4056
January 29, 2006 11:21AM
4392
January 30, 2006 09:42AM
4426
February 27, 2006 02:17PM
4107
February 27, 2006 02:23PM
4341
March 05, 2006 04:56AM
4158
March 06, 2006 08:09AM
4129
April 05, 2006 01:03PM
4305
September 27, 2006 08:43AM
4261
November 19, 2006 04:42AM
4411
December 14, 2006 05:45PM
4233
February 01, 2007 04:40AM
4900
November 11, 2007 01:24PM
5111
December 20, 2007 10:40AM
6545
January 21, 2008 10:14AM
5882
January 21, 2008 10:53AM
5355
May 19, 2008 09:41AM
5556
February 05, 2008 10:27AM
6103
March 12, 2008 08:37AM
5420
May 19, 2008 03:02AM
Re: Is there a solution to this?
6156
November 14, 2008 12:31AM
7167
March 06, 2009 03:36PM