On 23/03/2011 09:08, Warren Young wrote:
> 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.
It's not necessarily strictly doubled.
I don't see why you'd ever reserve *more* than the number of
records possible from your query. What a pointless waste of
space. If anything, you'd reserve *exactly* the number of
records possible.
Tom