List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:July 14 2007 4:57am
Subject:Re: Newbie question: very slow performance
View as plain text  
William F. Dowling wrote:
> 	    mysqlpp::Query query = con.query();
> 	    query << "call get_some_data(" << mysqlpp::quote
>                   << ck << ")";
> 	    mysqlpp::Result res = query.store();

You do realize that a store() query puts the entire result set in 
memory?  If the result set is large, your speed hit could be due to 
virtual memory thrashing.  If so, switch to a use() query.  Read the 
user manual for details.

> 	    if (res) {
> 		mysqlpp::Row row = res.at(0);  // count returns one row
> 		*result = row.at(0).get_string();

See the reference manual as of the 2.3.2 release for why get_string() is 
inefficient.  Something more like this should do better:

	if (res) {
		mysqlpp::Row row = res.at(0);
		result->assign(row.raw_data(0), row.raw_size(0));

This makes a straight copy from the mysqlpp::Row innards into the 
std::string, no temporaries.
Thread
Newbie question: very slow performanceWilliam F. Dowling13 Jul
  • Re: Newbie question: very slow performanceWarren Young14 Jul