Re: work_mem = 900MB but Sort Method: external merge Disk: 304008kB - Mailing list pgsql-general

From Andreas Kretschmer
Subject Re: work_mem = 900MB but Sort Method: external merge Disk: 304008kB
Date
Msg-id 20110222165438.GA5661@tux
Whole thread Raw
In response to work_mem = 900MB but Sort Method: external merge Disk: 304008kB  (Reid Thompson <Reid.Thompson@ateb.com>)
List pgsql-general
Reid Thompson <Reid.Thompson@ateb.com> wrote:

> What am I missing that causes this to resort to sorting on disk?
>
> obc=# select version();
>                                                  version
> ----------------------------------------------------------------------------------------------------------
>  PostgreSQL 8.3.7 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42)
> (1 row)
>
> Time: 43.920 ms
>
> >
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >  Limit  (cost=1063641.92..1063643.47 rows=20 width=13) (actual time=422710.147..422711.328 rows=20 loops=1)
> >    ->  Unique  (cost=1063641.92..1064133.33 rows=6320 width=13) (actual time=422710.022..422711.127 rows=20
loops=1)
> >          ->  Sort  (cost=1063641.92..1063887.62 rows=98282 width=13) (actual time=422710.014..422710.696 rows=172
loops=1)
> >                Sort Key: cpn.value
> >                Sort Method:  external merge  Disk: 304008kB

Bad estimation: rows=98282, actual rows=172



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°

pgsql-general by date:

Previous
From: Jeff Amiel
Date:
Subject: Covert database from ASCII to UTF-8
Next
From: Howard Cole
Date:
Subject: Reordering a table