On Mar 23, 2011, at 3:00 AM, Warren Young wrote:
> On Mar 22, 2011, at 6:48 PM, Paul Dalach wrote:
>
>> I am pulling ~80k objects with four fields. Does that constitute huge?
>
> Well, it depends on how big those fields are, doesn't it? If they are four 32 byte
> strings, the amount of data in use is at least 10 GB.
Sorry, got my MB confused with my GB there. 80,000 records x 4 x 32-byte strings is ~10
MB, not 10 GB.
Still, the answer may still be valid if the field sizes are large enough.
Keep in mind also the behavior of std::vector, which StoreQueryResult is based on. (More
or less, it is a 2D vector of mysqlpp::String.) It doubles in size each time you exceed
its size, so it can keep growing. That means lots of RAM copies for such a large number
of fields.
You can solve some of that by calling res.reserve(N), where N is larger than the number of
records possible from the query, but you still have to deal with the fact that you're
trying to store all that in RAM at once.