On Fri, Feb 22, 2008 at 8:54 AM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > "Dawid Kuroczko" <qnex42@xxxxxxxxx> writes: > > I have recently found a nice utility called memstat (which shows how > > much of private > > (not shared)) memory each process uses. What kind of surprised me was > > the amount > > of memory that is used by PL/pgSQL (one more reason not to provide it > > by default? ;-)). > > Why should we put any credence whatsoever in these numbers? > I rather doubt that "memstat" knows anything about our palloc > mechanism, so I don't see how it could possibly give reliable > answers about how much memory one portion or another of Postgres > is using. > > Having said that, it would be interesting to know exactly what it > *is* measuring. Correct me if I'm wrong, as well, but I believe that Linux (and probably other modern Unices) does code-sharing, meaning that separate processes referring to the same code/libraries will refer to the same copy in physical memory. So, even though each process is seeing 40 MB of libpgsql, there's likely only 1 copy in physical memory. So, the total memory consumption in the system from this library is 40 MB, not 40*num_processes MB. Peter ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings