Closed pkly closed 3 years ago
The point is valid, however this will in general boil down to superfluous micro-optimization as MySQL/MariaDB/Postgres/MSSQL and any other database worth their salt will also note that the query is identical and return the cached result immediately. I highly doubt this optimization would ever provide measurable performance increase in exchange for making all filtered queries slightly slower (you're now building the query DQL 4 times instead of 2).
So closing this unless I get proof the optimization is worth it 😉 thnx anyway!
In ORMAdapter::prepareQuery there's the following code
Yet, this is not quite always necessary.
A simple text comparison can tell us if we've already ran a query. If yes, there's no need to run it again.