Yup. This is a normal behaviour. mysql_free_result() will result in bringing each unasked rows to the client and freeing it up row by row.
BTW, why do you need to do - "select * from ????" Karam --- Renald Buter <[EMAIL PROTECTED]> wrote: > Hello list, > > I am having this issue with mysql_use_result: it > seems it will iterate > over all unused results if I call > 'mysql_free_result'. The following > code illustrates this: > > mysql_query(&mysql,"SELECT * FROM > a_very_large_table"); > res = mysql_use_result(&mysql); > i = 0; > while (row = mysql_fetch_row(res)) { > fprintf(stderr,"%d,%d\n", row[0], row[1]); > if (++i > 5) > break; > } > fprintf(stderr,"freeing...\n"); > mysql_free_result(res); > /* wait wait wait wait wait wait wait wait ... */ > > With 'mysql_store_results', the code would run out > of memory, because > the table is very large (20m rows). But this version > will run up to 2 > minutes, taking all CPU cycles with it, just > "free"ing the result. > > Is this normal behaviour or can I change something > for the better? > > I am using mysql 4.0.22 client and server on Linux > 2.6. > > > Thanks! > > Renald > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]