Re: Bulk inserts and usage_count

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bulk inserts and usage_count
Date: 2007-05-15 23:15:48
Message-ID: 20070515231548.GZ20707@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 15, 2007 at 04:37:28PM +0100, Heikki Linnakangas wrote:
> While testing the buffer ring patch, I noticed that bulk inserts with
> both INSERT and COPY pin and unpin the buffer they insert to for every
> tuple. That means that the usage_count of all those buffers are bumped
<snip>
> A fix for COPY will fall naturally out of the buffer ring patch, but not
> for INSERT.
>
> A more general fix would be to somehow keep the last insertion page
> pinned across calls to heap_insert.

ISTR discussion in the past about having things like COPY and INSERT
INTO ... SELECT building entire pages in one shot once they exhaust the
FSM. Not only would it address this issue, but it would probably improve
performance in many ways (less locking and unlocking, ability to
pre-sort before inserting into indexes, fewer calls to FSM, probably a
bunch of other things).
--
Jim Nasby decibel(at)decibel(dot)org
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2007-05-15 23:18:42 Re: Not ready for 8.3
Previous Message Bruce Momjian 2007-05-15 23:02:08 Re: Not ready for 8.3