I'm just start learing PHPCR with Doctrine and Jackalope DBAL implemnetation.
Using the Symfony 2 debug toolbar I can see that, for a simple form and with parent property selection, it takes 15 queries (...
added for readability):
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_workspaces ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_namespaces
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_type_nodes
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_type_props ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_type_childs ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_type_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_type_props ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_type_childs ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
[2014-08-24 15:55:48] doctrine.DEBUG: SELECT ... FROM phpcr_nodes ...
I have just three nodes:
/
/root
/root/child
I've added a simple form (as explained here) to create a new document and set its parent:
$form = $this->createFormBuilder($doc = new Document(), ['required' => false])
->add('name', 'text')
->add('title', 'text')
->add('parent', 'phpcr_document', [
'property' => 'id',
'class' => 'Acme\DemoBundle\Document\Document',
'multiple' => false,
])
->add('content', 'textarea')
->add('submit', 'submit')
->getForm()
->handleRequest($request);
if ($form->isValid()) {
// ...
}
return [('form' => $form->createView()];
How can I lower the number of queries?
There are several things to consider here:
That being said, we do expect that there is still room for improvement in Jackalope Doctrine DBAL for performance but so far we have mostly focused on adding new features. But for example cmf.symfony.com runs on SQLite without any reverse proxy but using the metadata and node cache supported by Jackalope Doctrine DBAL and provides quite acceptable performance.