[TYPO3-dev] Further development of DBAL

Jigal van Hemert jigal.van.hemert at typo3.org
Fri Aug 8 12:09:51 CEST 2014


Hi,

On 7-8-2014 22:22, Andreas Fernandez wrote:
> At least I can bypass the subselect used in
> "fetchMaximalVersionsForAllExtensions" by
> changing the query. The changed query is a bit buggy since it misses ~30
> extensions
> which are covered by the  currently used query.
> Here is a pastebin to the change and it's impact:
> http://pastebin.com/ESZYX6LU

These are two rather different queries. The one with the HAVING clause 
just limits the returned grouped records which have MAX(integer_version) 
 > 0.

If you look in the results you'll notice that the result set of the 
query with the HAVING clause has records with current_version = 0 (and 
also often not the highest available version number), while the one with 
the sub query only has the most recent versions.

The sub query is there to make sure that the latest version of the 
extension is used in the group; HAVING will not have that effect.

The current solution is rather inefficient (it uses a correlated 
subquery) and can be optimized with either a uncorrelated subquery or a 
left join (see [1]) . Especially the left join solution will be DBAL 
compatible AFAIK.

[1] 
http://dev.mysql.com/doc/refman/5.5/en/example-maximum-column-group-row.html

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org



More information about the TYPO3-dev mailing list