Reputation: 714
I want to have more than one connection to my database.
i am using persistent => false
and 5 ajax calls has been made which fetch data, and now each query is waiting for prvs to complete.
I want all these 5 queries run in parallel
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'user' => 'cluster',
'password' => '',
'database' => 'cluster',
'prefix' => '',
);
EDIT:- I got my problem, the problem is blocking connections are being made, how to make non blocking request for my requests..?
Upvotes: 0
Views: 367
Reputation: 2594
I think you want to excute a set of query simultaneously, I think you need to connect databse dynamically, Just see the bellow link, may be help you
https://stackoverflow.com/a/13224580/2460470
Upvotes: 1
Reputation: 25698
Just copy and paste your connection and name it different and use that name in your models useDbConfig property, that's all.
But what you say doesn't make much sense. Each of the 5 AJAX calls creates a complete new request and runs through the whole php stack before it even reaches the DB. The way you want to "optimize" this just doesn't make sense.
Upvotes: 0