From: Paul D. <pa...@sn...> - 2003-07-30 21:22:50
|
At 16:21 -0400 7/30/03, Steven Richman wrote: >Hi, > >I'm using DBI with MySQL, and am having a problem using the block version >of select_all with a large table. > >If I do > dbh.select_all('select * from small_table') do |row| > p row > end >it works fine. > >If I do > dbh.select_all('select * from big_table limit 10') do |row| > p row > end >it works fine. > >If I do > dbh.select_all('select * from big_table') do |row| > p row > end >(where big_table is 25 gigs) it hangs without executing the block, and >the mysqld server process pegs the CPU. > >I'm guessing that the block version of select_all is fetching the entire >result set instead of fetching rows lazily (i.e., it's equivalent to >dbh.select_all(...).each do |row|). Please tell me this isn't the case... It's the case. The MySQL driver for DBI (dbd_mysql) operates in such a way that the mysql_store_result() from the C library is used in all cases, rather than mysql_use_result(). > >thanks a lot, >steven. |