サポート #30

サポート #26: レスポンスが重い

DBテーブルindex最適化

山本 義治約11年前に追加. 約11年前に更新.

ステータス:新規開始日:2013/12/19
優先度:通常期日:
担当者:-進捗 %:

0%

カテゴリ:DB作業時間の記録:-
対象バージョン:-

説明

click_log,action_log,access_action_logテーブルのindex最適化

履歴

#1 山本 義治約11年前に更新

  • トラッカーバグ から サポート に変更

1) mergeテーブルを使用しているソースを改修
 click_log_merge→click_log_201312
 action_log_merge→access_action_log_201312

2) テーブルindex追加
3) 月次テーブル作成スクリプト改修
4) 月次テーブル作成スクリプト実行
5) 1)のソースを元に戻す

#2 山本 義治約11年前に更新

mergeテーブルを使用しているソース一覧

ad/www/ac/action.php: $sql = "select * from action_log_merge where aff_id = '$aff_id'";
ad/www/ac/action.php: $tsql = "select * from action_log_merge where c_id = '$c_id' and user_id = '$user_id' and p_id = '$program_id'";
ad/www/ac/action.php: $tsql = "select * from action_log_merge where c_id = '$c_id' and subscriber = '$subscriber' and p_id = '$program_id'";
ad/www/ac/action_admit.php: $sql = "select * from action_log_merge where c_id = '$c_id' and aff_id = '$afid' and (status = '0' or status = '4')";
ad/www/ac/action_admit.php: $sql = "select * from action_log_merge where c_id = '$c_id' and user_id = '$user_id' and (status = '0' or status = '4')";
ad/www/ac/action_admit.php: $tsql = "select * from click_log_merge where aff_id = '$aff_id'";
ad/www/ac/action_test.php: $sql = "select * from action_log_merge where aff_id = '$aff_id'";
ad/www/ac/action_test.php: $tsql = "select * from action_log_merge where c_id = '$c_id' and user_id = '$user_id' and p_id = '$program_id'";
ad/www/ac/action_test.php: $tsql = "select * from action_log_merge where c_id = '$c_id' and subscriber = '$subscriber' and p_id = '$program_id'";
ad/www/ac/pointback.php:$sql = "select * from action_log_merge where aff_id = '$aff_id'";
ad/www/ac/pointback.php:$tsql = "update action_log_merge set
ad/www/api/list.php: $sql = "select * from click_log_merge where aff_id = '$afid' and c_id = '$c_id' and (status = '0' or status = '3')";
ad/www/api/list.php: $sql = "select * from click_log_merge where aff_id = '$afid' and (status = '0' or status = '3')";
ad/www/api/list.php: $tsql = "update click_log_merge set status = '1' where aff_id = '$afid'";
ad/www/cl/click.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and subscriber = '$subscriber' and click_date >= '$click_check_date'";
ad/www/cl/click.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and ip = '$ip' and click_date >= '$click_check_date'";
ad/www/cl/click.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and agent = '$agent' and click_date >= '$click_check_date'";
ad/www/cl/click_app.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and subscriber = '$subscriber' and click_date >= '$click_check_date'";
ad/www/cl/click_app.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and ip = '$ip' and click_date >= '$click_check_date'";
ad/www/cl/click_app.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and agent = '$agent' and click_date >= '$click_check_date'";
ad/www/cl/click_test.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and subscriber = '$subscriber' and click_date >= '$click_check_date'";
ad/www/cl/click_test.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and ip = '$ip' and click_date >= '$click_check_date'";
ad/www/cl/click_test.php: $sql = "select click_log_id from click_log_merge where c_id = '$c_id' and m_id = '$m_id' and agent = '$agent' and click_date >= '$click_check_date'";
ad/www/cl/reverseAction.php: $sql = "select * from action_log_merge where aff_id = '$aff_id'";
ad/www/cl/reverseAction.php: $tsql = "select * from action_log_merge where c_id = '$c_id' and user_id = '$user_id' and p_id = '$program_id'";
ad/www/cl/reverseAction.php: $tsql = "select * from action_log_merge where c_id = '$c_id' and subscriber = '$subscriber' and p_id = '$program_id'";
admin/cron/point_back_retry.php:$sql = "select * from action_log_merge where point_back_response = 2";
admin/cron/point_back_retry.php: $tsql = "update action_log_merge set point_back_response = 4 where aff_id = '$aff_id[$retry_numrows]'";
admin/cron/point_back_retry.php: $tsql = "update action_log_merge set
admin/www/asp/search/rm_db.php: $sql = "delete from click_log_merge where asp_id = '".addslashes($asp_id)."'";
admin/www/asp/search/rm_db.php: $sql = "delete from action_log_merge where asp_id = '".addslashes($asp_id)."'";
admin/www/client_owner/search/rm_db.php: $tsql = "delete from click_log_merge where c_id = '".addslashes($c_id)."'";
admin/www/client_owner/search/rm_db.php: $tsql = "delete from action_log_merge where c_id = '".addslashes($c_id)."'";
admin/www/content/search/log_reset.php:$sql = "delete from click_log_merge where c_id = '$c_id'";
admin/www/content/search/log_reset.php:$sql = "delete from action_log_merge where c_id = '$c_id'";
admin/www/content/search/log_reset_asp.php:$sql = "delete from click_log_merge where c_id = '$c_id' and asp_id = '$asp_id'";
admin/www/content/search/log_reset_asp.php:$sql = "delete from action_log_merge where c_id = '$c_id' and asp_id = '$asp_id'";
admin/www/content/search/log_reset_listing.php:$sql = "delete from click_log_merge where c_id = '$c_id' and listing_id = '$listing_id'";
admin/www/content/search/log_reset_listing.php:$sql = "delete from action_log_merge where c_id = '$c_id' and listing_id = '$listing_id'";
admin/www/listing/search/rm_db.php: $sql = "delete from click_log_merge where listing_id = '".addslashes($listing_id)."'";
admin/www/listing/search/rm_db.php: $sql = "delete from action_log_merge where listing_id = '".addslashes($listing_id)."'";
admin/www/log/action_log_convert_20121217.php: $sql = "select action_log_id,c_id,m_id,asp_id,t_id,career,agent,term_name,ip,user_id,m_user_id,action_cost_set,action_ratio_set,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,status,amount,point_back_url,item_amount,item_num,p_id from action_log_merge where aff_id = '$aff_id[$i]'";
admin/www/log/action_log_convert_20121220.php: $sql = "select action_log_id,c_id,m_id,asp_id,t_id,career,agent,term_name,ip,user_id,m_user_id,action_cost_set,action_ratio_set,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,status,amount,point_back_url,item_amount,item_num,p_id from action_log_merge where aff_id = '$aff_id[$i]'";
admin/www/log/csv_cost_update_chk.php: $sql = "select m_id,asp_id,aff_id,action_cost_set,action_cost_cl_set,commission_cost,commission_cost_cl,click_date,order_date,admit_date,status,amount from action_log_merge where c_id = '$c_id_db[$i]' and aff_id = '$aff_id[$i]' and p_id = '$p_id[$i]'";
admin/www/log/csv_cost_update_db.php: $sql = "select action_log_id,m_id,asp_id,t_id,career,agent,term_name,ip,user_id,m_user_id,action_cost_set,action_ratio_set,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,admit_date,status,amount,point_back_url,item_amount,item_num,p_id from action_log_merge where c_id = '$c_id_db[$i]' and aff_id = '$aff_id[$i]' and p_id = '$p_id[$i]'";
admin/www/media/search/rm_db.php: $tsql = "delete from click_log_merge where m_id = '".addslashes($m_id)."'";
admin/www/media/search/rm_db.php: $tsql = "delete from action_log_merge where m_id = '".addslashes($m_id)."'";
admin/www/media_owner/search/rm_db.php: $tsql = "delete from click_log_merge where m_id = '".addslashes($m_id)."'";
admin/www/media_owner/search/rm_db.php: $tsql = "delete from action_log_merge where m_id = '".addslashes($m_id)."'";
admin/www/stat/content/csv_action_admit.php: $sql = "select m_id,asp_id,aff_id,user_id,click_cost_cl,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,status,amount from action_log_merge where c_id = '$c_id' and aff_id = '$aff_id[$i]' and status = '0'";
admin/www/stat/content/csv_action_admit_db.php: $sql = "select action_log_id,m_id,asp_id,listing_id,t_id,career,agent,term_name,ip,user_id,m_user_id,action_cost_set,action_ratio_set,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,status,amount,point_back_url,item_amount,item_num,p_id from action_log_merge where c_id = '$c_id' and aff_id = '$aff_id[$i]' and status = '0'";
admin/www/stat/content/csv_resign.php: $sql = "select m_id,asp_id,aff_id,user_id,click_cost_cl,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,resign_date,status,amount from action_log_merge where c_id = '$c_id' and aff_id = '$aff_id[$i]' and status = '4'";
admin/www/stat/content/csv_resign_db.php: $sql = "select action_log_id,m_id,asp_id,listing_id,career,agent,term_name,ip,user_id,m_user_id,action_cost_set,action_ratio_set,action_cost_cl_set,action_ratio_cl_set,click_date,order_date,resign_date,status,amount,point_back_url,item_amount,item_num,p_id from action_log_merge where c_id = '$c_id' and aff_id = '$aff_id[$i]' and status = '4'";
user/www/merchant/admit/admit_ok.php:$sql = "select count() from action_log_merge $query";
user/www/merchant/admit/admit_ok.php: $tsql = "select * from click_log_merge where aff_id = '$aff_id_db'";
user/www/merchant/admit/csv.php:$sql = "select action_log_id,asp_id,listing_id,m_id,user_id,click_cost_cl,action_cost_cl_set,action_ratio_cl_set,commission_cost_cl,click_date,order_date,status,amount from action_log_merge $query $order_query";
user/www/merchant/admit/index.php:$sql = "select count(
) from action_log_merge $query";
user/www/merchant/admit/index.php:$sql = "select action_log_id,asp_id,listing_id,m_id,user_id,click_cost_cl,action_cost_cl_set,action_ratio_cl_set,commission_cost_cl,click_date,order_date,status,amount from action_log_merge $query $order_query $limit_query";
user/www/merchant/index.php: $ssql = "select count() from action_log_merge where c_id = '$c_id[$i]' and status = '0'";
user/www/merchant/index_test.php: $ssql = "select count(
) from action_log_merge where c_id = '$c_id[$i]' and status = '0'";
user/www/merchant/referer/csv.php: $sql = "select count() from click_log_merge $query";
user/www/merchant/referer/csv.php: $sql = "select count(
) from action_log_merge $query";
user/www/merchant/referer/csv.php: $sql = "select click_log_id,asp_id,referer,user_id,click_cost,action_cost_set,action_ratio_set,click_date,status from click_log_merge $query $order_query $limit_query";
user/www/merchant/referer/csv.php: $sql = "select action_log_id,asp_id,referer,m_user_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount,point from action_log_merge $query $order_query $limit_query";
user/www/merchant/referer/csv.php,v:$sql = "select count() from action_log_merge $query";
user/www/merchant/referer/csv.php,v:$sql = "select action_log_id,asp_id,referer,m_user_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount,point from action_log_merge $query $order_query $limit_query";
user/www/merchant/referer/index.php: $sql = "select count(
) from click_log_merge $query";
user/www/merchant/referer/index.php: $sql = "select count() from action_log_merge $query";
user/www/merchant/referer/index.php: $sql = "select click_log_id,asp_id,referer,user_id,click_cost,action_cost_set,action_ratio_set,click_date,status from click_log_merge $query $order_query $limit_query";
user/www/merchant/referer/index.php: $sql = "select action_log_id,asp_id,referer,m_user_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount,point from action_log_merge $query $order_query $limit_query";
user/www/merchant/referer/index.php.bk:$sql = "select count(
) from action_log_merge $query";
user/www/merchant/referer/index.php.bk:$sql = "select action_log_id,asp_id,referer,m_user_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount,point from action_log_merge $query $order_query $limit_query";
user/www/merchant/report/referer.php:$sql = "select count() from action_log_merge $query";
user/www/merchant/report/referer.php:$sql = "select action_log_id,asp_id,c_id,m_user_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount,point from action_log_merge $query $order_query $limit_query";
user/www/partner/report/user.php: $sql = "select count(
) from action_log_merge $query";
user/www/partner/report/user.php: $sql = "select count(click_log_id) from click_log_merge $query";
user/www/partner/report/user.php:$sql = "select action_log_id,asp_id,c_id,m_user_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount,point from action_log_merge $query $order_query $limit_query";
user/www/partner/report/user.php:$sql = "select click_log_id,asp_id,c_id,user_id,click_date from click_log_merge $query $order_query $limit_query";
user/www/partner/report/user_csv.php:$sql = "select m_id,c_id,m_user_id,p_id,click_cost,action_cost_set,action_ratio_set,commission_cost,click_date,order_date,status,amount from action_log_merge $query $order_query";

他の形式にエクスポート: Atom PDF