Subject Re: [firebird-support] Re: Memory Usage when accessing larger tables
Author Ann W. Harrison
At 02:24 AM 11/29/2004, williamvdw2004 wrote:


>This select is not critical to the working of my program and I have
>commented it out, then the next select statemnt takes the 250 mb of
>ram. This statemment is as follows.
>
>'SELECT MAX(TIMESENT) AS LASTREC from ' + TableName

That statement almost certainly requires a sort of the whole
table. The memory usage you see is the sort buffers. I think
the configuration file allows you to establish some limits on
the amount of memory the sort can take, but you'd have to check.
And, naturally, reducing the amount of memory available to sort
will slow the sorts down considerably.

To avoid the (enormously expensive) sort, put a descending
index on TIMESENT.

Regards,


Ann