List:MySQL++« Previous MessageNext Message »
From:William F. Dowling Date:July 13 2007 6:13pm
Subject:Newbie question: very slow performance
View as plain text  
I am seeing very slow performance when using mysql++ to access a local
db.  By "very slow" I mean, slower by a factor of 100-1000, in
comparison to running the same queries (in every case, a call to a
stored procedure) by piping them into the mysql command line client.

Can anybody suggest what I my be doing wrong to get such bad
performance?  (It is likely someting simple, since I am new to mysql++.)

My code for one of the procedures is this:

     // throw away empty results that are side effect of multi-query
    void skip_remaining_multi_results(mysqlpp::Query &query)
    {
	while (query.more_results()) {
	    query.store_next();
	}
    }
... 
    void get_some_data(const std::string &ck, std::string *result)
    {
	try {
	    mysqlpp::Query query = con.query();
	    query << "call get_some_data(" << mysqlpp::quote
                  << ck << ")";
	    mysqlpp::Result res = query.store();
	    if (res) {
		mysqlpp::Row row = res.at(0);  // count returns one row
		*result = row.at(0).get_string();
	    }
	    skip_remaining_multi_results(query);
	}
	catch (const mysqlpp::BadQuery& er) {
	    // Handle any query errors
	    throw sdb_exception(er.what(), QUERY);
        }
	catch (const mysqlpp::Exception& er) {
	    // Catch-all for any other MySQL++ exceptions
	    throw sdb_exception(er.what(), MYSQLPP);
	}
    }

Thanks for any suggestions!

Will


-- 
William F Dowling
william.dowling@stripped
www.scientific.thomson.com
Thread
Newbie question: very slow performanceWilliam F. Dowling13 Jul
  • Re: Newbie question: very slow performanceWarren Young14 Jul