Re: [Cppcms-users] Avoid loading query results completely into cppdb::result
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2015-04-01 10:22:12
|
CppDB (if the backed allows) fetches the data row by row and not the entire collection: Unprepared statements: http://sourceforge.net/p/cppcms/code/HEAD/tree/cppdb/trunk/drivers/mysql_backend.cpp#l75 Prepared statement: http://sourceforge.net/p/cppcms/code/HEAD/tree/cppdb/trunk/drivers/mysql_backend.cpp#l510 cppdb::result is sort of cursor you iterate over the data set. The delay probably caused by initial query and not fetching itself. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ From: Alexander Mack (EvalSys) <a....@ev...> To: cpp...@li... Sent: Wednesday, April 1, 2015 12:36 PM Subject: [Cppcms-users] Avoid loading query results completely into cppdb::result Dear Artyom, Dear community, I was wondering if it's possible, to avoid loading the complete query result into cppdb::result but handle the query results "step by step"? If I'm running the following query on a bigger database <code> cppdb::result r = sql << "SELECT name,age FROM students"; </code> it takes a lot of time to copy all the results into the cppdb::result container. For testing I tried that for about 6 mio entries.. I didn't work with the original MySQL-lib yet.. but if I send the query using the standard MySQL lib e.g. <code> res = mysql_perform_query(conn, "SELECT * FROM students"); while ((row = mysql_fetch_row(res)) !=NULL) .... </code> it seems that the interface delivers single rows only, if I'm fetching the result (row by row). Now I was wondering, if there is some technique / flag to do the same with cppdb? In the end I'm trying to run through a big amount of data. If I'm trying offset/limit combinations, it gets very slow as soon as offset increases.. It'd be great, if someone would have a tipp for me. Thank you very much, Alex ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |