| From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
|---|---|
| To: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
| Cc: | Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>, Anj Adu <fotographs(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org |
| Subject: | Re: partition insert performance |
| Date: | 2009-06-22 13:06:43 |
| Message-ID: | 87vdmov2n0.fsf@hi-media-techno.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Hi,
Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> writes:
> On Mon, Jun 15, 2009 at 11:35 AM, Gurjeet Singh<singh(dot)gurjeet(at)gmail(dot)com> wrote:
>> On Mon, Jun 15, 2009 at 10:57 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
>> wrote:
>>> If you're using plpgsql prepare for a world of pain if you've got any
>>> null values in your inserts.
>>
>> :) Using COALESCE isn't that bad.
>
> In my experience it's WAY more than just coalesce.
There's this trick:
v_sql := 'INSERT INTO schema.parent_' || to_char(NEW.date, 'YYYYMM') ||
' SELECT (' || quote_literal(textin(record_out(NEW))) || '::schema.parent).*;';
EXECUTE v_sql;
This will handle dynamic SQL and NULLs correctly, but as said already
won't match static SQL in term of performances. Just saying for people
searching simplifications.
Regards,
--
dim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dimitri Fontaine | 2009-06-22 13:18:57 | Re: Is IDLE session really idle? |
| Previous Message | Michael Monnerie | 2009-06-22 09:04:48 | Re: WAL archiving and backup TAR |