| From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
|---|---|
| To: | Sergey Konoplev <gray(dot)ru(at)gmail(dot)com> |
| Cc: | Dave Johansen <davejohansen(at)gmail(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-performance <pgsql-performance(at)postgresql(dot)org> |
| Subject: | Re: Recommendations for partitioning? |
| Date: | 2013-12-30 21:29:07 |
| Message-ID: | 20131230212907.GT22570@eldon.alvh.no-ip.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Sergey Konoplev escribió:
> On Fri, Dec 20, 2013 at 7:59 AM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
> > Eh. Why can't you just do something like
> >
> > WITH moved AS (
> > DELETE FROM src WHERE ..
> > RETURNING *
> > ) INSERT INTO dst SELECT * FROM moved;
>
> Avero, I think it could be cheaper to do this like it is shown below, correct?
>
> psql dbname -c 'copy src to stdout' | \
> psql dbname -c 'copy dst from stdin; truncate src;'
Yes, if you can get rid of the old records by removing or emptying a
partition (or de-inheriting it, as suggested elsewhere in the thread),
that's better than DELETE because that way you don't create dead rows to
vacuum later.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2013-12-31 17:55:38 | Re: Performance bug in prepared statement binding in 9.2? |
| Previous Message | Sergey Konoplev | 2013-12-30 20:21:53 | Re: Recommendations for partitioning? |