Re: partition insert performance

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

 



Hi,

Scott Marlowe <scott.marlowe@xxxxxxxxx> writes:
> On Mon, Jun 15, 2009 at 11:35 AM, Gurjeet Singh<singh.gurjeet@xxxxxxxxx> wrote:
>> On Mon, Jun 15, 2009 at 10:57 PM, Scott Marlowe <scott.marlowe@xxxxxxxxx>
>> 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

-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux