[SQL] Re: [SQL] unnesting of array of different size explodes memory

2011-04-13 Thread Charlie
g of array of different size explodes memory To: "pgsql sql" Cc: "Hans Joachim Münzer" Hi, I need to sum up the elements of two arrays. Most arrays were of the same size, thus I just unnested the arrays in one table and grouped the results in a loop for every row. When two

Re: [SQL] unnesting of array of different size explodes memory

2011-04-13 Thread Tom Lane
Andreas Gaab writes: > As I now understand, the following query leads to 12 results, not just 4 (or > 3...): > SELECT unnest(ARRAY[1,2,3]), unnest(ARRAY[4,5,6,7]); > Why could postgres use as much memory till the kernel complained when > unnesting 1200 and 1300 elements resulting in 1.6e6 rows

[SQL] unnesting of array of different size explodes memory

2011-04-13 Thread Andreas Gaab
Hi, I need to sum up the elements of two arrays. Most arrays were of the same size, thus I just unnested the arrays in one table and grouped the results in a loop for every row. When two arrays of different size (1200 and 1300) were processed, the memory usage exploded and the query was killed