Sunday 15 June 2014

optimization - MySQL slow on SELECT WITH "OR" on multiple columns -


I have a table that has 3 miles of rows and when I use this query to select:

  order_code, store_debit, where 4624603 TOTAL_PRICE order (ID, PID) and `status` = -6;   

or this question (using OR )

  SELECT order_code, Store_debit, total_price command WHERE (id = 4624603 or pid = 4624603) and `position` = -6;   

And he has & gt; 17secs was but when I separate the two questions:

  Where select order_code, store_debit, TOTAL_PRICE ordered id = 4624603 and `Status` = -6;   

and

  select order_code, TOTAL_PRICE = 4624603 and `the store_debit, where PID command Status` = - 6;   

This Instant returns

Thank you all!

Update: The table indexes

  cop_type payment_type, cod_type, cash_transfer, PID, position, normalized BTREE all_type payment_type Generic BTREE search_order_code order_code generic BTREE theodoi user_id, PID, payment_type, cash_transfer, status, report_atm, pay_status, normal BTREE item_lib item_id, status, pay_status, payment_type, generic BTREE search_phone generic BTREE search_order_email Email General BTREE order_work cod_id, status, district, payment_ Rkar, pay_status, cash_transfer, cod_type, free_ship general BTREE select_hot province, state, type, built, payment_type, pay_status, ITEM_ID general BTREE coupon_after_buy ID, PID, state, free_ship general BTREE search_ofice office, created, conditions, ship_status general BTREE SEARCH_ITEM ITEM_ID, Office of making, normal BTRI idx_ward_id ward_id general btri idx_street road_id normal btri idx_graphcode group code, with normal status ID General Bitiaar Aidiaks_pattaim Bhugtan_tim general Bitiarai Khoj_any PID, status, general Bitiarai Aidiakskountri_prkar country's typing General Bitiarai Aidiaks_buk_taim Buk_ time general Bitiari    

How about using a union of the last two? Maybe / or maybe forcing a table scan.

No comments:

Post a Comment