I'm trying to optimise a large MySQL query. I accidentally found out that a query with all fields listed (SELECT Orders.id AS Orders__id, <...>
; the default CakePHP behaviour) takes 4 times longer compared to a query with just SELECT * FROM
- 0.324 seconds vs. 0.084 seconds; checked several times.
I'm wondering if I can disable this behaviour. I've tried:
adding
'fields' => '*'
to thefind()
options or calling->select('*')
, but it results inSELECT Orders.* AS Orders__*
which throws an SQLSTATE[42000] error.getting rid of the aliased title with
->select(['*' => '*'])
as per query-builder.html#selecting-data, but that results inSELECT * AS *
which also throws an errorusing
->enableAutoFields(false)
I also tried to Google but I don't even know how to call this