Version

Documentation » Page

15. API »

« 13. Varnish

14. Performance

This page try to list any good tips to improve performance.

14.1. Indexes

The Doctrine ORM cannot defined indexes for varchar as the Doctrine’s metadata framework does not accept the length requirement. So if you want to speed up queries you need to manually add indexes:

ALTER TABLE `page__snapshot` ADD INDEX `idx_snapshot_route_name` (`route_name` (32), `site_id`);
ALTER TABLE `page__snapshot` ADD INDEX `idx_snapshot_page_alias` (`page_alias` (32), `site_id`);
ALTER TABLE `page__snapshot` ADD INDEX `idx_snapshot_url` (`url` (32), `site_id`);
ALTER TABLE `page__page` ADD INDEX `idx_page_route_name` (`route_name` (32), `site_id`);
ALTER TABLE `page__page` ADD INDEX `idx_page_page_alias` (`page_alias` (32), `site_id`);
ALTER TABLE `page__page` ADD INDEX `idx_page_url` (`url` (32), `site_id`);

14.2. Snapshots

If your application contains a lot of snapshots which are not used anymore, this can slowdown the database server. You can clean up old snapshots by running the command:

php app/console sonata:page:cleanup-snapshots --site=all --keep-snapshots=5

Found a typo? Something is wrong in this documentation? Just fork and edit it!