From: | Peter Kroon <plakroon(at)gmail(dot)com> |
---|---|
To: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
Cc: | Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: create table in memory |
Date: | 2012-11-26 20:01:13 |
Message-ID: | CAOh+DOmpRU7-k2UfmHg=Ri10Hwdz5bci2ru=s5dAiOD_hxFNjA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Could you provide an example?
Fo me:
Drop/Creat/populating tables inside a function are slow.
Creating tables outside a function and populating he table inside a
function is fast..
2012/11/24 Craig Ringer <craig(at)2ndquadrant(dot)com>
> On 11/24/2012 02:15 AM, Peter Kroon wrote:
> > I found out that declaring tables outside of functions increases the
> > execution time of the function.
> Strictly, what's probably happening is that creating a table in the same
> transaction as populating it is a lot faster than creating it,
> committing, and populating it in a new transaction. In the 1st case WAL
> logging for the heap can be avoided if you aren't using replication or
> PITR (ie wal_level is minimal).
>
> Functions are automatically wrapped in a transaction if you don't open
> one explicitly so doing a CREATE TABLE inside a function will be
> quicker. The same result should be achieved by beginning a transaction,
> creating the table, then calling the function.
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Vlad K. | 2012-11-26 20:07:19 | Re: Copy rows, remember old and new pkey |
Previous Message | Peter Kroon | 2012-11-26 19:57:34 | Re: ERROR: query has no destination for result data |