Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12201

MYSQL join query taking long to fetch even a single row

$
0
0
    SELECT        obo.id, obo.ready_notified, obo.view_notified, obo.order_name,        CONVERT_TZ(obo.submitted_at, 'GMT', 'America/New_York') AS submitted_at,        obo.order_counter, obo.is_pos, obo.occasion, obo.dine_in_table_number,        obo.cashier_id, obo.terminal_name, obo.terminal_id, obo.payment_type,        obo.total, obo.is_paid_by_split, obo.payment_type_raw, obo.is_submitted,        obo.is_cancelled, obo.is_split_cancelled,obo.has_refund, obo.has_adjustment,         obo.adjusted_total, obo.tip,        obo.refund_total, obo.refund_pending, obo.order_hash,    GROUP_CONCAT(oth.transaction_id) AS transaction_id    FROM    order_botorder oboLEFT JOIN order_ordertransactionhistory AS oth ON obo.id = oth.bot_order_idWHERE    obo.store_id = 407    AND obo.is_open = 0    AND (obo.is_submitted = 1 OR obo.is_closed = 1)            and (                   CAST(obo.id AS CHAR) LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.phone_number LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.order_counter LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.dine_in_table_number LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.delivery_address LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.occasion_raw LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.terminal_id LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.cashier_id LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.payment_type_raw LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR obo.total LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'                OR oth.transaction_id LIKE '%tr_7AcXLYxUSK6K0WBVshqg1g%'            )GROUP BY    obo.idORDER BY    obo.submitted_at DESCLIMIT    10 OFFSET 0;

here is the explainnation of the query it is almost searching data in 285384 that should not happen

idselect_typetablepartitionstypepossible_keyskeykey_lenrefrowsfilteredExtra
1SIMPLEoboNULLrefPRIMARY, order_botorder_order_counter_store_id_d14a38a1_uniq, order_botor_id_43a8b8_idx, order_botorder_order_hash_6c7414b4, idx_order_botorder_occasion, idx_order_botorder_phone_number, idx_order_botorder_order_counter, idx_order_botorder_dine_in_table_number, order_botorder_server_id_id_a2196482_fk_auth_user_id, idx_submitted_at, order_botor_is_subm_7011be_idx, order_botor_has_sub_df4837_idx, order_botor_is_clos_dfa4b1_idx, order_botor_is_tab__25acbe_idx, order_botor_is_pos_7954a9_idx, order_botor_is_onli_8f9a5f_idx, order_botor_submitt_736eb5_idx, idx_orderbotorder_id, idx_is_cancelled, idx_occasion, idx_optimized_query, idx_obo_store_id, idx_obo_submitted_closed_open, idx_obo_id, idx_obo_phone_number, idx_obo_order_counter, idx_obo_dine_in_table_number, idx_obo_occasion_raw, idx_obo_terminal_id, idx_obo_cashier_id, idx_obo_payment_type_raw, idx_obo_total, idx_fulltext_order_detailsidx_optimized_query6const, const285384100.00Using index condition; Using temporary; Using filesort
1SIMPLEothNULLrefidx_bot_order_id, order_order_bot_ord_baf3b4_idx, idx_oth_bot_order_idorder_order_bot_ord_baf3b4_idx4order_api_migration.obo.id1100.00Using where; Using index

Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>