PHQL is by default one of the fastest ORM technologies available in PHP but even so there are still things that need to be understood if one wishes to achieve top efficiency. In this recipe, we will first start with the least efficient approach and then we will progress to two increasingly faster and more memory-efficient approaches. The first stage of this recipe will involve generating database records and their linked records. Once we have created these records then we can perform the three tests to see how they measure up.
This recipe uses the Phalcon Developer Tools, which we will use to set up a project skeleton.
We will need a database connection for this recipe.
Follow these steps to complete this recipe:
We need to have an application skeleton for experimentation. If you already have such an application, you can skip this step. Create a project skeleton using the
cli
template:phalcon project optimize_phql cli
Create the database,
optimize_phql...