P
P
Petr Zhuchkov2014-07-28 16:04:44
Doctrine ORM
Petr Zhuchkov, 2014-07-28 16:04:44

Doctrine 2 why is the first query taking longer?

I do:

for ($i = 0; $i < 5; $i++) {
  $time = microtime(true);
  $em->getRepository('Test\Entity')->findAll();
  echo microtime(true) - $time;
}

Query execution time
0.049312114715576
0.0063920021057129
0.0064208507537842
0.005681037902832
0.0060789585113525
Why is the first fetch so long? In this case, the entities can be different, but the first one always works out much longer.
I install the cache - memcache
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$config->setResultCacheImpl($cache);
$config->setHydrationCacheImpl($cache);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Petr Zhuchkov, 2014-07-29
@HelsingG

They didn’t exactly find the problem, but most likely the problem is in the server (virtualka) T, k. no problems were found on the local machine and production(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question