Search Postgresql Archives

Re: Out of Memory - 8.2.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> writes:
> ! 		/* no need to allocate more space than we have pages */
> ! 		maxtuples = LAZY_ALLOC_TUPLES * relblocks;

Uh ... you need to guard against integer overflow in this calculation.
Perhaps leave the current initialization alone, and then after the
Min-reduction steps add

        /* curious coding to ensure the multiplication can't overflow */
	if ((BlockNumber) (maxtuples / LAZY_ALLOC_TUPLES) > relblocks)
		maxtuples = relblocks * LAZY_ALLOC_TUPLES;

which is demonstrably overflow-proof once maxtuples has been clamped to
less than INT_MAX.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux