我正在使用公司编写的php客户端来访问他们的Web服务.客户端非常全面,包括从Web服务端点生成的XML响应中填充的类.
当我在适当的网络服务器上运行它时,它的工作原理.但是,当我在本地使用它时,它会抛出一个没有收到数据的错误.
我已经检查了所有StackOverflow,我通常会找到我的问题的答案,但这个让我疯了!
这是httpPost函数(作为他们提供的php客户端的一部分编写):
private function _httpPost(array $parameters)
{
$query = $this->_getParametersAsString($parameters);
$url = parse_url ($this->_config['ServiceURL']);
$scheme = '';
switch ($url['scheme']) {
case 'https':
$scheme = 'https://';
$port = $port === null ? 443 : $port;
break;
default:
$scheme = '';
$port = $port === null ? 80 : $port;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $scheme . $url['host'] . $url['path']);
curl_setopt($ch, CURLOPT_PORT, $port);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $this->_config['UserAgent']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, …
Run Code Online (Sandbox Code Playgroud) 我试图弄清楚为什么查询在我的MySQL数据库上这么慢.我已经阅读了有关MySQL性能,各种SO问题的各种内容,但这对我来说仍然是个谜.
除了answer_text之外,我在所有列上都有索引
我正在运行的查询是:
SELECT answer_id, COUNT(1)
FROM answers_onsite a
WHERE a.screen_id=384
AND a.timestamp BETWEEN 1462670000000 AND 1463374800000
GROUP BY a.answer_id
Run Code Online (Sandbox Code Playgroud)
此查询大约需要20-30秒,然后给出结果集:
任何见解?
编辑
如我所知,我的节目创建表:
CREATE TABLE 'answers_onsite' (
'id' bigint(20) unsigned NOT NULL AUTO_INCREMENT,
'device_id' bigint(20) unsigned NOT NULL,
'survey_id' bigint(20) unsigned NOT NULL,
'answer_set_group' varchar(255) NOT NULL,
'timestamp' bigint(20) unsigned NOT NULL,
'screen_id' bigint(20) unsigned NOT NULL,
'answer_id' bigint(20) unsigned NOT NULL DEFAULT '0',
'answer_text' text,
PRIMARY KEY ('id'),
KEY 'device_id' ('device_id'), …
Run Code Online (Sandbox Code Playgroud)