phalcon

WBOY
Release: 2016-06-06 20:11:40
Original
1080 people have browsed it

这两天研究phalcon, 感觉mysql查询很慢啊, 是我写的不对吗

bootstrap

<code> $this->_di->setShared('dbSlave', function () use ($config) {
            return new Mysql(array(
                "host"     => $config->dbSlave->host,
                "username" => $config->dbSlave->username,
                "password" => $config->dbSlave->password,
                "dbname"   => $config->dbSlave->name
            ));
        });</code>
Copy after login
Copy after login
<code>$b = Users::findFirst([
        'id = :bid:',
        'bind' => ['bid' => 1]
    ]);
    echo $b->name;</code>
Copy after login
Copy after login

感觉查询卡了一两秒

回复内容:

这两天研究phalcon, 感觉mysql查询很慢啊, 是我写的不对吗

bootstrap

<code> $this->_di->setShared('dbSlave', function () use ($config) {
            return new Mysql(array(
                "host"     => $config->dbSlave->host,
                "username" => $config->dbSlave->username,
                "password" => $config->dbSlave->password,
                "dbname"   => $config->dbSlave->name
            ));
        });</code>
Copy after login
Copy after login
<code>$b = Users::findFirst([
        'id = :bid:',
        'bind' => ['bid' => 1]
    ]);
    echo $b->name;</code>
Copy after login
Copy after login

感觉查询卡了一两秒

MySQL用bind-address = 127.0.0.1限制只能本地访问时,Windows7上PHP用localhost访问MySQL明显变慢,用127.0.0.1则正常.

我用phalcon不会啊,你用php原生的mysqli查询一次看看需要多久。和你php服务器和mysql服务器之间的连接速度也有关系。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template