Hi there,
I’ve been nailing my head to the table trying to fix this one and well other than moving to innodb (I shall be, but I want to fix this in MYISAM first!!) I just can’t get it to work correctly!
I am running one of two queries around 60,000 times, changing values each time, the queries look like, this problem only seems to occur after multiple thousands of iterations and when performed on an UPDATE/INSERT with subqueries with COUNTs, please note I am on a production server so cannot install debugging tools:
update query:
UPDATE rank AS r SET r.yesterdays_rank = INTEGER, r.rank = INTEGER, r.platform = INTEGER, r.yesterdays_platform_rank = INTEGER, r.platform_rank = INTEGER, r.wishlists = (SELECT count(w.gid) FROM wishlists AS w WHERE w.gid = INTEGER), r.collections = (SELECT count(c.gid) FROM collections AS c WHERE c.gid = INTEGER), r.tracking = (SELECT count(t.gid) FROM track AS t WHERE t.gid = INTEGER)WHERE game = INTEGER
insert query:
INSERT INTO rank ( id, game, rank, yesterdays_rank, platform, platform_rank, yesterdays_platform_rank, wishlists, collections, tracking )VALUES ( ‘’, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, (SELECT count(w.gid) FROM wishlists AS w WHERE w.gid = INTEGER), (SELECT count(c.gid) FROM collections AS c WHERE c.gid = INTEGER), (SELECT count(t.gid) FROM track AS t WHERE t.gid = INTEGER) )
Rank “explain”:
id int(20) NO PRI (null) auto_incrementgame int(20) NO MUL rank int(20) NO MUL yesterdays_rank int(20) NO platform int(20) NO platform_rank int(20) NO yesterdays_platform_rank int(20) NO wishlists int(20) NO collections int(20) NO tracking int(20) NO
Wishlists “explain”:
uid int(11) unsigned NO MUL gid int(20) unsigned NO
Collections “explain”:
uid int(11) unsigned NO MUL gid int(20) unsigned NO
Track “explain”:
uid int(11) unsigned NO MUL gid int(20) unsigned NO MUL lastvisit int(20) NO
And finally the My.cnf
[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Default to using old password format for compatibility with mysql 3.x# clients (those using the mysqlclient10 compatibility package).old_passwords=1#skip-locking#skip-innodblog-slow-queries=sporilong_query_time=2log-long-formatinnodb_buffer_pool_size = 2048Minnodb_file_io_threads = 4key_buffer_size=128Mmax_allowed_packet=4Mtable_cache=2048sort_buffer=4Mrecord_buffer=4Mthread_cache=18thread_concurrency=8thread_cache_size=256myisam_sort_buffer_size=128Mmax_connections=6000max_connect_errors=10000tmp_table_size=512Mread_rnd_buffer_size=12Mquery_cache_limit=8Mquery_cache_size=384Mquery_cache_type=1join_buffer=4Msort_buffer_size=4Mread_buffer_size=4Mft_min_word_len=1[mysql.server]user=mysqlcharacter-set=asciicollation=ascii_general_ciconnection=ascii_general_cicharacter_set_connection=ascii_general_ci[mysqld_safe]err-log=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[myisamchk]ft_min_word_len=1
I know the My.cnf is a total mess, but I’m not really sure what affects things so have tweaked a fair amount but any suggestions would be much appreciated.
Some specs:
Sun v20z 248 opteron
16gb ram
14x36gb disk 10 array (56% remaining)
Thanks in advance guys, would be forever in your favour if someone can manage to get this working again!