Hello guys, I am trying to speed up database query using the parallel computing toolbox. I have already tried two ways:
c = createConnectionForPool(gcp(), 'short_term_memory',"root","1234");
1)
f1 = parfeval(@(c,varargin) fetch(c.Value, varargin{:}),1,c,query1);
f2 = parfeval(@(c,varargin) fetch(c.Value, varargin{:}),1,c,query2);
f3 = parfeval(@(c,varargin) fetch(c.Value, varargin{:}),1,c,query3);
res1 = fetchOutputs(f1);
res2 = fetchOutputs(f2);
res3 = fetchOutputs(f3);
2)
queries = [query1,query2,query3];
parfor i = 1:length(queries)
conn = c.Value;
results = fetch(conn,queries(i));
res{i} = results
end
But neither of the two ways really reduces the total query time. What else I could do?