|RE: [firebird-support] Re: In memory sorting consumes alot of space
> Hi Ann,I don't know myself, perhaps postgres applies a simple compression to the intermediate sort files to minimize disk space usage.
> Thanks for your reply.
> I just posted an answer to Set:
> 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.
The fact that your query create a fully exploded result set of all columns in all of the query tables doesn't help -- it seems very unnecessary -- it only increases the size of the temp sort file.
One possible performance optimization (depending on the selectivity of the prdInCatTab.PINCPrimary column) would be to add an index on this column. This will not reduce the size of the temp sort file, but could improve overall query performance.