From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: work_mem = 900MB but Sort Method: external merge Disk: 304008kB |
Date: | 2011-02-22 17:17:40 |
Message-ID: | 20110222171740.GA6399@tux |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Reid Thompson <Reid(dot)Thompson(at)ateb(dot)com> writes:
> > What am I missing that causes this to resort to sorting on disk?
>
> The in-memory space required to sort N tuples can be significantly
> larger than the on-disk space, because the latter representation is
> optimized to be small and the in-memory representation not so much.
> I haven't seen a 3X differential before, but it's not outside the realm
> of reason, especially for narrow rows like these where it's all about
> the overhead. I suspect if you crank work_mem up still more, you'll see
> it switch over. It flips to on-disk sort when the in-memory
> representation exceeds the limit ...
Question: when is the planner making the decision between in-memory and
on-disk, at planning-time or at execution time with the knowledge about
the real amount of tuples?
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
From | Date | Subject | |
---|---|---|---|
Next Message | Vibhor Kumar | 2011-02-22 17:18:14 | Re: Reordering a table |
Previous Message | David Kerr | 2011-02-22 17:13:52 | Re: Reordering a table |