Join query including two generate_series calls causes big memory growth and crash

From: Jorge Arévalo <jorge(dot)arevalo(at)deimos-space(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Join query including two generate_series calls causes big memory growth and crash
Date: 2011-04-20 15:14:19
Message-ID: BANLkTikhe6ugUV9BzDZ9pfHw=-8k+w4Acg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I'm executing this query:

SELECT x, y, another_field FROM generate_series(1, 10) x,
generate_series(1, 10) y, my_table

The field 'another_field' belongs to 'my_table'. And that table has
360000 entries. In a 64 bits machine, with 4GB RAM, Ubuntu 10.10 and
postgres 8.4.7, the query works fine. But in a 32 bits machine, with
1GB RAM, Ubuntu 9.10 and postgres 8.4.7, the query process is killed
after taking about 80% of available memory. In the 64 bits machine the
query takes about 60-70% of the available memory too, but it ends.
And this happens even if I simply get x and y:

SELECT x, y FROM generate_series(1, 10) x, generate_series(1, 10) y, my_table

Is it normal? I mean, postgres has to deal with millions of rows, ok,
but shouldn't it start swapping memory instead of crashing? Is a
question of postgres configuration?

Thanks in advance,

--
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge(dot)arevalo(at)deimos-space(dot)com
http://es.linkedin.com/in/jorgearevalo80
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com
http://geohash.org/ezjqgrgzz0g

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-04-20 15:34:48 Re: Join query including two generate_series calls causes big memory growth and crash
Previous Message raghu ram 2011-04-20 14:31:19 Re: [GENERAL] How to uninstall PostgreSQL 8.4 on both Windows XP and Windows 7