MySql的性能非常慢

MySql的性能非常慢,mysql,Mysql,上面的代码执行起来非常慢。有人知道为什么吗 以下是有关表userLocations的信息 $remainingQuery = "select * from $value s where not exists ( select userID from userLocations ul where ul.userID = s.userID ) AND (userIP > '') GROUP BY userIP LIMIT 1"; $remainingResults

上面的代码执行起来非常慢。有人知道为什么吗

以下是有关表userLocations的信息

$remainingQuery = "select * from $value s
where not exists (
    select userID from userLocations ul 
    where ul.userID = s.userID
    )  AND (userIP > '') GROUP BY userIP LIMIT 1"; 
$remainingResults = mysql_query($remainingQuery) or die(mysql_error());
下面是一个以$value命名的表

enum('ipv4', 'ipv6')    latin1_swedish_ci
ip_start    varbinary(16)
ip_end  varbinary(16)
country char(2)
stateprov   varchar(80)
city    varchar(80)

我在你的询问中发现了一些问题。首先,您按userIP分组,并按1进行限制。这将只返回一个userIP,这是您真正想要的吗?您如何知道返回的是哪个用户IP

也许不在中使用会比您拥有的更快

name    varchar(20)
score   bigint(20)
log longtext
difficulty  int(10)
games   int(11)
checkSum    text
bought  tinyint(1)
time    timestamp
bundle  int(11)
userID  text
userIP  text
city    text
country text

我添加了更多信息,你还需要什么吗?速度到底有多慢?10秒左右,正常情况下,加载页面并显示它只需要0.5秒,主要是因为我自己与服务器的连接速度慢。仍然非常慢。我不知道是什么原因我想,我只是想试试。我可能会删除这个答案,因为可能还有其他事情。
SELECT *
FROM table s
WHERE s.userID NOT IN (SELECT userId FROM userLocations) AND (userIP > '')
GROUP BY userIP
LIMIT 1;