i got 2 tables (users and technologies) and i need to retrieve data from them both separately inside a 3rd Controller.
i can do that using loadmodel and find() then set datas to view via $this->set() but by doing that the website becomes very slow >70s and when i try retrieving only one it works fast.
So basically i need to optimise my query and speed up my DB
here's my code.
$users = $this->loadModel('Users');
$datas=$users->find('all')->select(['id','phone', 'first_name','last_name','birthday','email','website', 'address', 'resume', 'cv_url'])->where(['id' => 1])->bufferResults(false)->ToArray();
$technologies = $this->loadModel('Technologies');
$technologies=$technologies->find('all')->select(['id', 'name', 'slug', 'image', 'exp', 'exp_perc'])->bufferResults(false)->ToArray();
$this->set(compact('datas','technologies'));
as you can see i only have 2 queries but in debug it shows 10 and TABLE_SCHEMA took 35322ms and its called 2 time (35322*2)
Any suggestion is welcome.