我有下表命名posts
Column Type Null Default Comments
postId bigint(20) No 0
source varchar(10) No
profanity tinyint(1) No 0
postCreated bigint(15) Yes NULL
postMessage varchar(255) Yes NULL
possibleDuplicate varchar(255) Yes NULL Used for checking for duplicate messages
postUrl varchar(255) Yes NULL
postType varchar(10) No
postTag tinyint(11) No 0
media varchar(255) Yes NULL first result of COALESCE media1-4
media1 varchar(255) Yes NULL
media2 varchar(255) Yes NULL
media3 varchar(255) Yes NULL
media4 varchar(255) Yes NULL
latitude varchar(255) Yes NULL
longitude varchar(255) Yes NULL
userId bigint(20) Yes NULL
username varchar(255) Yes NULL
userFullname varchar(255) Yes NULL
userProfilePicture varchar(255) Yes NULL
它具有以下内容indexes
:
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No postId 355837 A No
postTag 355837 A No
postCreated BTREE No No postCreated 355837 A Yes
postTagIndex BTREE No No postTag 16 A No
postCreated 355837 A Yes
profanity 355837 A No
source BTREE No No source 139 A No
postTag 265 A No
filters BTREE No No postTag 16 A No used when filtering results
profanity 16 A No
postMessage 355837 A Yes
postCreated 355837 A Yes
当我运行此查询时:
SELECT
*
FROM
`posts`
WHERE
(
`postTag` = 24
AND `profanity` != 0
)
AND (
(
`source` = "instagram"
AND SUBSTRING(`postMessage`, 1, 4) != 'RT @'
AND `profanity` = - 1
)
OR (
`source` = "twitter"
AND SUBSTRING(`postMessage`, 1, 4) != 'RT @'
AND `profanity` = - 1
)
)
ORDER BY
`postCreated` DESC
LIMIT 0,
25
一切都很好,但是当我运行这个查询时:
SELECT
*
FROM
`posts`
WHERE
(
`postTag` = 24
AND `profanity` != 0
)
AND (
(
`source` = "instagram"
AND SUBSTRING(`postMessage`, 1, 4) != 'RT @'
AND `profanity` = - 1
)
OR (
`source` = "twitter"
AND SUBSTRING(`postMessage`, 1, 4) != 'RT @'
AND `profanity` = - 1
)
)
GROUP BY `possibleDuplicate`
ORDER BY
`postCreated` DESC
LIMIT 0,
25
我收到以下错误:
[Err] 126 - 表 '/tmp/#sql_6e6_0.MYI' 的密钥文件不正确;尝试修复它
仅当我将GROUP BY possibleDuplicate
添加到查询时才会发生这种情况。
possibleDuplicate
主要是文字,有时是空的。该表目前大约有 358399 行。希望有人可以帮助我解决这个问题。