php - Why does this SQL query kill my server? -


When I run this query from a varnish cache server on SQL Server

  select count (A separate email), in AICL files where user ID = (upload_user from okol_file where limit of upload_user = userid1)   

Table with aiki_users & gt; 80000 rows

and ocal_files tables and gt; 30000 lines

It kills the server. It is called through a php script through AJAX. I have to close the page that says it.

I do not know what this gives, but I know that what I want to do should be made with the group when it happens, but I do not have technical information.

The same_yujs table looks like this:

  If none exists, then 'AII_User' (`UIIID ') (9) unsigned Not Auto_interpret,' Username ' Varchar (100) faucet default '', `full_name` varchar (255) no tap,` country 'varchar (255) no tap, `gender' varchar (25) no, zero,` job 'varchar (255) no password `Vergar (100) No tap default '',` oauth_passcode` varchar (255) No, zero, `oauth_token` varchar (255) tap,` oauth_token_secret` varchar (255) tap, usergroup int (10) 0 ',' Email 'code (100) tap Default '', 'first_ip' varchar (40) tap default '0', 'first_login' datatyme faucet, 'last_login', datetime faucet, 'fault', 'avatar' varchar (255), 'homepage' varchar (100) 'Randaki' varchar (255) is not faucet, `` active '', 'last_p` is not acceptable,' user is not 'text,' merilist 'ent (1), log in_number`t (11) Act '(5) null, primary (`user id'), key 'username' ('userman')) engine = mesam default charge = utf8 aUTO_INCREMENT = 3;   

I do not have the right access to the server, I can not see the removal of the Oklal_files, but:

  ocal_files.aiki_users = aiki_users.userid   

Can anyone tell me how bad the query is and what is it?

You are selecting from both aiki_user and ocal_files in the main query, without specifying an included section , Where to stop joining the full table in the nested query ...

Comments