In my symfony project, I have a βcomplexβ request that looks like this:
$d = Doctrine_Core::getTable('MAIN_TABLE')
->luceneSearch($keywords)
->innerJoin('w.T1 ws')
->innerJoin('ws.T2 s')
->innerJoin('w.T3 piv')
->innerJoin('piv.T4 per')
->innerJoin('w.T5 st')
...
->innerJoin('doc.T12 docT')
->innerJoin('w.Lang lng')
->execute();
I added all these innerJoin to reduce the number of queries due to my data model. Virtually all data is recovered using this single request .... but the request took 2 to 20 seconds. depends on the keywords.
I decided to use memcache because the data does not change all the time.
What I did was configure memcache and add
...
->useResultCache(true)
->execute();
to my request.
It is strange that:
- The first time (when the cache is empty / colored), only one request is executed
- The second time ~ 130 ares is executed and takes longer than the first ...
These "new" queries retrieve data from the "inner join" for each record.
, " " ?
, , .
- ?