8.4devel out of memory - Mailing list pgsql-hackers

From Kevin Grittner
Subject 8.4devel out of memory
Date
Msg-id 48C0FEE4.EE98.0025.0@wicourts.gov
Whole thread Raw
Responses Re: 8.4devel out of memory  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
I was testing a very complex statistical query, with (among other
things) many EXISTS and NOT EXISTS tests against a build of the source
snapshot from 3 September.  (The query looks pretty innocent, but
those aren't tables, they're complicated views.)  Under 8.3.3 this
query runs successfully, but takes a few hours.  I started it last
night before leaving, on the same machine where 8.3.3 has been
running, and in the morning found this:

olr=# explain analyze
SELECT
      "MS"."sMatterNo",
      CAST(COUNT(*) AS int) AS "count"
  FROM
   "MatterSearch" "MS"
   JOIN "MatterDateStat" "S" ON
     (
      "S"."matterNo" = "MS"."sMatterNo" AND
       "S"."isOnHold" = FALSE
   )
  WHERE
  (
   "MS"."matterStatusCode" IN ('OP', 'RO')
  )
  GROUP BY "MS"."sMatterNo"
;
ERROR:  out of memory
DETAIL:  Failed on request of size 8.

It was running for about half an hour before I left, and I didn't
notice the error, so I'm pretty sure it took longer than that for this
error to appear.

kgrittn@OLR-DEV-PG:~> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              20G  8.0G   11G  43% /
tmpfs                 2.0G   16K  2.0G   1% /dev/shm
/dev/sda3             253G  7.9G  245G   4% /var/pgsql/data
kgrittn@OLR-DEV-PG:~> free -m
             total       used       free     shared    buffers
cached
Mem:          4049       2239       1809          0         94
1083
-/+ buffers/cache:       1061       2987
Swap:         1027        561        466

There are several development databases on this machine, all fairly
small, but enough that there's usually no significant free memory --
it gets used as cache.  The 1.8 GB free this morning suggests that
something allocated and free a lot of memory.

kgrittn@OLR-DEV-PG:~/postgresql-snapshot> uname -a
Linux OLR-DEV-PG 2.6.5-7.286-bigsmp #1 SMP Thu May 31 10:12:58 UTC 2007
i686 i686 i386 GNU/Linux
kgrittn@OLR-DEV-PG:~/postgresql-snapshot> cat /proc/version
Linux version 2.6.5-7.286-bigsmp (geeko@buildhost) (gcc version 3.3.3
(SuSE Linux)) #1 SMP Thu May 31 10:12:58 UTC 2007
kgrittn@OLR-DEV-PG:~/postgresql-snapshot> cat /etc/SuSE-release
SUSE LINUX Enterprise Server 9 (i586)
VERSION = 9
PATCHLEVEL = 3

Attached are the plans from 8.3.3 and 8.4devel.  Also attached are the
non-default 8.3.3 postgresql.conf settings; the file is the same for
8.4devel except for the port number.  I don't know if the specifics of
the views and tables would be useful here, or just noise, so I'll omit
them unless someone asks for them.

What would be the reasonable next step here?

-Kevin

kgrittn@OLR-DEV-PG:~> /usr/local/pgsql-8.4dev/bin/pg_config
BINDIR = /usr/local/pgsql-8.4dev/bin
DOCDIR = /usr/local/pgsql-8.4dev/share/doc
HTMLDIR = /usr/local/pgsql-8.4dev/share/doc
INCLUDEDIR = /usr/local/pgsql-8.4dev/include
PKGINCLUDEDIR = /usr/local/pgsql-8.4dev/include
INCLUDEDIR-SERVER = /usr/local/pgsql-8.4dev/include/server
LIBDIR = /usr/local/pgsql-8.4dev/lib
PKGLIBDIR = /usr/local/pgsql-8.4dev/lib
LOCALEDIR = /usr/local/pgsql-8.4dev/share/locale
MANDIR = /usr/local/pgsql-8.4dev/share/man
SHAREDIR = /usr/local/pgsql-8.4dev/share
SYSCONFDIR = /usr/local/pgsql-8.4dev/etc
PGXS = /usr/local/pgsql-8.4dev/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/usr/local/pgsql-8.4dev'
'--enable-integer-datetimes' '--enable-debug' '--disable-nls'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wendif-labels
-fno-strict-aliasing -g
CFLAGS_SL = -fpic
LDFLAGS = -Wl,-rpath,'/usr/local/pgsql-8.4dev/lib'
LDFLAGS_SL =
LIBS = -lpgport -lz -lreadline -lcrypt -ldl -lm
VERSION = PostgreSQL 8.4devel
kgrittn@OLR-DEV-PG:~> /usr/local/pgsql-8.4dev/bin/pg_controldata
/var/pgsql/data/kgrittn
pg_control version number:            842
Catalog version number:               200808311
Database system identifier:           5242286260647024629
Database cluster state:               in production
pg_control last modified:             Thu 04 Sep 2008 05:17:28 PM CDT
Latest checkpoint location:           0/26E7A718
Prior checkpoint location:            0/26E7A6D4
Latest checkpoint's REDO location:    0/26E7A718
Latest checkpoint's TimeLineID:       1
Latest checkpoint's NextXID:          0/3561
Latest checkpoint's NextOID:          49152
Latest checkpoint's NextMultiXactId:  1
Latest checkpoint's NextMultiOffset:  0
Time of latest checkpoint:            Thu 04 Sep 2008 05:17:28 PM CDT
Minimum recovery ending location:     0/0
Maximum data alignment:               4
Database block size:                  8192
Blocks per segment of large relation: 131072
WAL block size:                       8192
Bytes per WAL segment:                16777216
Maximum length of identifiers:        64
Maximum columns in an index:          32
Maximum size of a TOAST chunk:        2000
Date/time type storage:               64-bit integers
Float4 argument passing:              by value
Float8 argument passing:              by reference
Maximum length of locale name:        128
LC_COLLATE:                           C
LC_CTYPE:                             C


Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: code coverage patch
Next
From: "Marko Kreen"
Date:
Subject: Re: Need more reviewers!