简体   繁体   English

getQuery(Doctrine)运行非常慢

[英]getQuery (Doctrine) is running VERY VERY slow

I have setup a virtualbox running Linux Mint 16 x64 for R&D with Symfony2/Doctrine2. 我已经设置了一个运行Linux Mint 16 x64的虚拟机,用于使用Symfony2 / Doctrine2进行研发。 I installed Symfony via composer and it installed Doctrine with it. 我通过composer安装了Symfony,并用它安装了Doctrine。 I setup this up about 2-3 weeks ago so the version I'm using should be latest or at least very recent. 我在大约2-3周前设置了这个版本,所以我使用的版本应该是最新版本,或者至少是最新版本。

The virtual machine is running Apache/MySQL and PHP of course. 虚拟机当然正在运行Apache / MySQL和PHP。 I only have 1 new database/schema in MySQL database and I have only created 1 new table. 我在MySQL数据库中只有一个新的数据库/模式,我只创建了一个新表。 This new table only has less than 15 records so it shouldn't take that long to retrieve all the records. 这个新表只有不到15条记录,因此检索所有记录不需要那么长时间。

When I run a code like below, I get the results very quickly. 当我运行如下代码时,我很快就得到了结果。

var_dump($this->getDoctrine()->getEntityManager()->getRepository("my-class-here")->find(1);

But when I use query (see code below), the webpage often times out or Firefox just crashes. 但是当我使用查询(参见下面的代码)时,网页经常超时或者Firefox崩溃。

var_dump($this->getDoctrine()->getEntityManager()->createQuery("SELECT s FROM my-class-here s");

Any ideas what could be happening and how to fix it? 任何想法可能发生什么以及如何解决它?

thanks very much 非常感谢

尝试使用:

\Doctrine\Common\Util\Debug::dump($this->getDoctrine()->getEntityManager()->createQuery("SELECT s FROM my-class-here s"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM