Re: Speeding up INSERTs and UPDATEs to partitioned tables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Speeding up INSERTs and UPDATEs to partitioned tables
Date
Msg-id 17610.1532623666@sss.pgh.pa.us
Whole thread Raw
In response to Re: Speeding up INSERTs and UPDATEs to partitioned tables  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
David Rowley <david.rowley@2ndquadrant.com> writes:
> 1) Got rid of PARTITION_ROUTING_MAXSIZE. The code using this was
> useless since the int would have wrapped long before it reached
> UINT_MAX. There's no shortage of other code doubling the size of an
> array by multiplying it by 2 unconditionally without considering
> overflowing an int. Unsure why you considered this more risky.

As long as you're re-palloc'ing the array each time, and not increasing
its size more than 2X, this is perfectly safe because of the 1GB size
limit on palloc requests.  You'll fail because of that in the iteration
where the request is between 1GB and 2GB, just before integer overflow
can occur.

(Yes, this is intentional.)

            regards, tom lane


pgsql-hackers by date:

Previous
From: Cynthia Shang
Date:
Subject: Re: Allow COPY's 'text' format to output a header
Next
From: Dean Rasheed
Date:
Subject: Re: [HACKERS] [PATCH] Overestimated filter cost and its mitigation