我正在執行下面的查詢,幾秒鐘後我得到一個「MySQL服務器已經消失」的錯誤。我試圖增加wait_timeout,max_allowed_packet和其他一些由人們建議的變量,但我無法修復它。MySQL服務器已經走了 - 試過了一切
SELECT tmp.filter_group_id,
tmp.filter_id,
tmp.product_id
FROM
(SELECT *
FROM
(SELECT f.filter_group_id,
pf.filter_id,
p.product_id,
(IFNULL(
(SELECT price
FROM oc_product_special AS ps
WHERE ps.product_id = p.product_id
AND ps.customer_group_id = '1'
AND ((ps.date_start = '0000-00-00'
OR ps.date_start < NOW())
AND (ps.date_end = '0000-00-00'
OR ps.date_end > NOW()))
ORDER BY ps.priority ASC, ps.price ASC LIMIT 1),
IFNULL(
(SELECT price
FROM oc_product_discount AS pd2
WHERE pd2.product_id = p.product_id
AND pd2.customer_group_id = '1'
AND pd2.quantity >= '1'
AND ((pd2.date_start = '0000-00-00'
OR pd2.date_start < NOW())
AND (pd2.date_end = '0000-00-00'
OR pd2.date_end > NOW()))
ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1), p.price)) * 1) AS mf_price
FROM oc_product AS p
INNER JOIN oc_product_filter AS pf ON pf.product_id = p.product_id
INNER JOIN oc_filter AS f ON f.filter_id = pf.filter_id
INNER JOIN oc_product_to_store AS p2s ON p2s.product_id = p.product_id
AND p2s.store_id = 0
INNER JOIN oc_product_to_category AS p2c ON p2c.product_id = p.product_id
INNER JOIN oc_category_path AS cp ON cp.category_id = p2c.category_id
WHERE p.date_available <= NOW()
AND p.status = '1'
AND (FIND_IN_SET(18, p.mfilter_values))
AND cp.path_id IN(6)) AS tmp
WHERE (mf_price > 40
AND mf_price < 701)) AS tmp
WHERE tmp.filter_group_id NOT IN(1);
^這是查詢導致從日誌文件中得到的麻煩。
如果我用「SELECT tmp。*」更改了「SELECT tmp.filter_group_id,tmp.filter_id,tmp.product_id」部分,查詢可以正常工作,並在0.2秒內返回結果。不幸地改變它不會解決我的問題,因爲有另一個查詢,如:
SELECT mfp.filter_group_id,
mfp.filter_id,
COUNT(DISTINCT mfp.product_id) FROM ([THE QUERY ABOVE]) as mfp
GROUP BY mfp.filter_group_id,
mfp.filter_id;
所以我必須得到第一個查詢工作。有什麼建議麼?
編輯:
這裏是mysql.log
18:43:06 UTC - mysqld got exception 0xc0000005 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
key_buffer_size=2147483648
read_buffer_size=16777216
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 2852645 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x1c6215421c0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
7ff64e61d542 mysqld.exe!Item_subselect::exec()[item_subselect.cc:575]
7ff64e6231b2 mysqld.exe!Item_singlerow_subselect::val_decimal()[item_subselect.cc:1259]
7ff64e490f53 mysqld.exe!Item_func_ifnull::decimal_op()[item_cmpfunc.cc:3382]
7ff64e51bf4b mysqld.exe!Item_func_numhybrid::val_decimal()[item_func.cc:1453]
7ff64e511586 mysqld.exe!Item_func_mul::decimal_op()[item_func.cc:2067]
7ff64e51bf4b mysqld.exe!Item_func_numhybrid::val_decimal()[item_func.cc:1453]
7ff64e4e46ac mysqld.exe!Item_direct_ref::val_decimal()[item.cc:8598]
7ff64e48ef18 mysqld.exe!Arg_comparator::compare_decimal()[item_cmpfunc.cc:1763]
7ff64e49d4b1 mysqld.exe!Item_func_gt::val_int()[item_cmpfunc.cc:2608]
7ff64e4e3a41 mysqld.exe!Item::val_bool()[item.cc:211]
7ff64e49cb9c mysqld.exe!Item_cond_and::val_int()[item_cmpfunc.cc:6102]
7ff64ea3682e mysqld.exe!evaluate_join_record()[sql_executor.cc:1483]
7ff64ea3a437 mysqld.exe!sub_select()[sql_executor.cc:1288]
7ff64ea369b5 mysqld.exe!evaluate_join_record()[sql_executor.cc:1634]
7ff64ea3a437 mysqld.exe!sub_select()[sql_executor.cc:1288]
7ff64ea356c1 mysqld.exe!do_select()[sql_executor.cc:941]
7ff64ea3703b mysqld.exe!JOIN::exec()[sql_executor.cc:199]
7ff64e608571 mysqld.exe!handle_query()[sql_select.cc:185]
7ff64e4c27f6 mysqld.exe!execute_sqlcom_select()[sql_parse.cc:4947]
7ff64e4c46de mysqld.exe!mysql_execute_command()[sql_parse.cc:2597]
7ff64e4c7faa mysqld.exe!mysql_parse()[sql_parse.cc:5363]
7ff64e4c12c9 mysqld.exe!dispatch_command()[sql_parse.cc:1287]
7ff64e4c226a mysqld.exe!do_command()[sql_parse.cc:854]
7ff64e469634 mysqld.exe!handle_connection()[connection_handler_per_thread.cc:295]
7ff64ee7ad82 mysqld.exe!pfs_spawn_thread()[pfs.cc:2195]
7ff64eba46fb mysqld.exe!win_thread_start()[my_thread.c:38]
7ff64ef3b39f mysqld.exe!_callthreadstartex()[threadex.c:376]
7ff64ef3b5ea mysqld.exe!_threadstartex()[threadex.c:354]
7ff887d48364 KERNEL32.DLL!BaseThreadInitThunk()
7ff888b65e91 ntdll.dll!RtlUserThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (1c6215902a0): (18:43:06 UTC - mysqld got exception 0xc0000005 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
key_buffer_size=2147483648
read_buffer_size=16777216
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 2852645 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x1c6215421c0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
7ff64e61d542 mysqld.exe!Item_subselect::exec()[item_subselect.cc:575]
7ff64e6231b2 mysqld.exe!Item_singlerow_subselect::val_decimal()[item_subselect.cc:1259]
7ff64e490f53 mysqld.exe!Item_func_ifnull::decimal_op()[item_cmpfunc.cc:3382]
7ff64e51bf4b mysqld.exe!Item_func_numhybrid::val_decimal()[item_func.cc:1453]
7ff64e511586 mysqld.exe!Item_func_mul::decimal_op()[item_func.cc:2067]
7ff64e51bf4b mysqld.exe!Item_func_numhybrid::val_decimal()[item_func.cc:1453]
7ff64e4e46ac mysqld.exe!Item_direct_ref::val_decimal()[item.cc:8598]
7ff64e48ef18 mysqld.exe!Arg_comparator::compare_decimal()[item_cmpfunc.cc:1763]
7ff64e49d4b1 mysqld.exe!Item_func_gt::val_int()[item_cmpfunc.cc:2608]
7ff64e4e3a41 mysqld.exe!Item::val_bool()[item.cc:211]
7ff64e49cb9c mysqld.exe!Item_cond_and::val_int()[item_cmpfunc.cc:6102]
7ff64ea3682e mysqld.exe!evaluate_join_record()[sql_executor.cc:1483]
7ff64ea3a437 mysqld.exe!sub_select()[sql_executor.cc:1288]
7ff64ea369b5 mysqld.exe!evaluate_join_record()[sql_executor.cc:1634]
7ff64ea3a437 mysqld.exe!sub_select()[sql_executor.cc:1288]
7ff64ea356c1 mysqld.exe!do_select()[sql_executor.cc:941]
7ff64ea3703b mysqld.exe!JOIN::exec()[sql_executor.cc:199]
7ff64e608571 mysqld.exe!handle_query()[sql_select.cc:185]
7ff64e4c27f6 mysqld.exe!execute_sqlcom_select()[sql_parse.cc:4947]
7ff64e4c46de mysqld.exe!mysql_execute_command()[sql_parse.cc:2597]
7ff64e4c7faa mysqld.exe!mysql_parse()[sql_parse.cc:5363]
7ff64e4c12c9 mysqld.exe!dispatch_command()[sql_parse.cc:1287]
7ff64e4c226a mysqld.exe!do_command()[sql_parse.cc:854]
7ff64e469634 mysqld.exe!handle_connection()[connection_handler_per_thread.cc:295]
7ff64ee7ad82 mysqld.exe!pfs_spawn_thread()[pfs.cc:2195]
7ff64eba46fb mysqld.exe!win_thread_start()[my_thread.c:38]
7ff64ef3b39f mysqld.exe!_callthreadstartex()[threadex.c:376]
7ff64ef3b5ea mysqld.exe!_threadstartex()[threadex.c:354]
7ff887d48364 KERNEL32.DLL!BaseThreadInitThunk()
7ff888b65e91 ntdll.dll!RtlUserThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (1c6215902a0): SELECT tmp.filter_group_id, ... the query above)
Connection ID (thread ID): 10
Status: NOT_KILLED
編輯2: 順便說一句,這是MySQL的5.7.9服務器這是我的Windows機器上運行我使用WAMP。
我有同樣的分貝(至少有5個多行)在我的共享主機的服務器的2:
- MySQL的23年6月5日
- 的Percona 5.6.28-76.1
兩者幾乎立即運行查詢。
你檢查了錯誤日誌文件嗎? – Dekel
這是MySQL服務器版本5.7。9,也許? –
@ Michael-sqlbot是的,它是5.7.9 –