gpt4 book ai didi

mysql - 2013 error Lost connection to MySQL server during query 错误

转载 作者:行者123 更新时间:2023-11-29 01:04:34 26 4
gpt4 key购买 nike

查询 1 是

SELECT id,state,submission_id FROM document WHERE submission_id>=0;
+---------+-------+---------------+
| id | state | submission_id |
+---------+-------+---------------+
| 3000001 | -1 | 12345 |
+---------+-------+---------------+
1 row in set (0.00 sec)

很明显,submission_id >=0 的记录只有一条。

查询 2 是

SELECT id,state,submission_id FROM document WHERE submission_id>=0 OR state=0 ORDER BY submission_id LIMIT 5;
ERROR 2013 (HY000): Lost connection to MySQL server during query

第三个查询是在我等了10分钟之后

SELECT * from document WHERE state=0 OR submission_id>=0 order by submission_id desc limit 5;

+----+-------+---------------+
| id | state | submission_id |
+----+-------+---------------+
| 1 | 1 | -1 |
| 2 | 1 | -1 |
| 3 | 1 | -1 |
| 4 | 1 | -1 |
| 5 | 1 | -1 |
+----+-------+---------------+

怎么了? id=3000001 应该是第一个吧?

这发生在我为“submission”列建立索引之后。无论如何要删除此列以使其不被索引?

引用“描述文档”的样子

+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| state | int(11) | YES | MUL | NULL | |
| submission_id | int(11) | YES | MUL | NULL | |
+---------------+--------------+------+-----+---------+----------------+

最佳答案

这里是如何删除 submission_id 索引

ALTER TABLE document DROP INDEX submission_id;

如果索引的名称不是 submission_id,您可以通过以下方式找到它:

SHOW CREATE TABLE document\G

您将在底部看到带有定义的索引的表定义。

您将看到索引的正确名称。

另一种查找 submission_id 索引名称的方法是:

SELECT index_name FROM information_schema.statistics
WHERE table_name='document'
AND column_name='submission_id';

关于mysql - 2013 error Lost connection to MySQL server during query 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8842371/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com