我有下面的SQL查询
SELECT CustomerID FROM sales WHERE `Date` <= '2012-01-01' GROUP BY CustomerID
Run Code Online (Sandbox Code Playgroud)
查询执行超过11400000行并且运行速度非常慢.执行需要3分钟.如果我删除分组,则运行时间低于1秒.这是为什么?
MySQL Server版本是'5.0.21-community-nt'
Here is the table schema:
CREATE TABLE `sales` (
`ID` int(11) NOT NULL auto_increment,
`DocNo` int(11) default '0',
`CustomerID` int(11) default '0',
`OperatorID` int(11) default '0',
PRIMARY KEY (`ID`),
KEY `ID` (`ID`),
KEY `DocNo` (`DocNo`),
KEY `CustomerID` (`CustomerID`),
KEY `Date` (`Date`)
) ENGINE=MyISAM AUTO_INCREMENT=14946509 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Run Code Online (Sandbox Code Playgroud) 编辑:更详细的解释
我们有以下设置:
NGINX反向代理设置为执行SSL卸载。所有内部通信均通过HTTP进行。重定向的设置如下:
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Original-For $proxy_add_x_forwarded_for;
proxy_set_header X-Original-Proto $scheme;
proxy_cache_bypass $http_upgrade;
IS4在app.UseIdentityServer之前具有以下设置
var fordwardedHeaderOptions = new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto
};
fordwardedHeaderOptions.KnownNetworks.Clear();
fordwardedHeaderOptions.KnownProxies.Clear();
app.UseForwardedHeaders(fordwardedHeaderOptions);
在客户端RequireHttpsMetadata设置为FALSE
在IS4端,所有客户端都配置为具有“ RedirectUris”和“ PostLogoutRedirectUris”的HTTPS地址。
在客户端,IdentityServerAuthenticationOptions的配置如下:
new IdentityServerAuthenticationOptions
{
Authority = "https://[OAUTH_ADDRESS]",
ApiName = "[API_NAME]",
ApiSecret = "[API_SECRET]",
RequireHttpsMetadata = false
}
实际发生的是,当我们尝试访问我们在IS4客户端中注册的其中一个,并且该请求被重定向到IS4进行身份验证时,我们会看到“未经授权的客户端”消息屏幕。此外,在检查了重定向请求的查询字符串之后,我们可以看到返回URL是HTTP而不是HTTPS。
请指教。