Subject | Re: In memory sorting consumes alot of space |
---|---|
Author | haris_p_sw |
Post date | 2013-05-17T18:44:26Z |
--- In firebird-support@yahoogroups.com, Ann Harrison <aharrison@...> wrote:
Thanks for your reply.
I just posted an answer to Set:
http://tech.groups.yahoo.com/group/firebird-support/message/121760
You can see there that I have solved this specific problem. I agree with what you 're saying(I don't have a fraction of your knowledge on the subject but it seems very logical). I just can't understand how postgres does it so well.
Regards,
Haris.
>Hi Ann,
> On Thu, May 16, 2013 at 12:35 PM, haris_p_sw <haris_p_sw@...> wrote:
>
> >
> >
> > Why Firebird sorts datasets loading whole rows into memory when the plan
> > is NATURAL? Couldn't it sort only primary keys for example? There might be
> > something I 'm missing...
> >
> >
> Firebird actually doesn't sort whole rows, it sorts only the rows requested
> in the query - so select * is your enemy here as well. If it were to sort
> carrying only the columns in the ORDER BY clause and the RDB$DB_KEY, it
> would then have to make random reads for each row in the result set.
> Random reads all over the database are even more expensive than the block
> reads used to retrieve sorted subsets of the query.
>
> Allocate as much memory as feasible for sorts and use a fast disk (or disk
> equivalent) for temp space.
>
> Good luck,
>
>
> Ann
>
>
> [Non-text portions of this message have been removed]
>
Thanks for your reply.
I just posted an answer to Set:
http://tech.groups.yahoo.com/group/firebird-support/message/121760
You can see there that I have solved this specific problem. I agree with what you 're saying(I don't have a fraction of your knowledge on the subject but it seems very logical). I just can't understand how postgres does it so well.
Regards,
Haris.