I have the following table named 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
It has the following 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
When I run this query:
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
Everything is fine, but when I run this query:
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
I get the following error:
[Err] 126 - Incorrect key file for table '/tmp/#sql_6e6_0.MYI'; try to repair it
It only happens when I add GROUP BY possibleDuplicate
to the query.
possibleDuplicate
is mostly text, sometimes it's empty. The table has around 358399 rows at the moment.
Hopefully someone can help me to fix this.