Re: SQL/MED - file_fdw

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQL/MED - file_fdw
Date: 2011-01-14 04:03:27
Message-ID: AANLkTik9sL0oV=VxjNRaY1mvv2D9Z6QmofSyr0ADL6dy@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 13, 2011 at 19:00, Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp> wrote:
> But EndCopyFrom() seems not to be able to release memory which is
> allocated in BeginCopy() and BeginCopyFrom().  I found this behavior
> by executing a query which generates nested loop plan (outer 1000000
> row * inner 10 row), and at last postgres grows up to 300MB+ from
> 108MB (VIRT of top command).
>
> Attached patch would avoid this leak by adding per-copy context to
> CopyState.  This would be overkill, and ResetCopyFrom() might be
> reasonable though.

Good catch. I merged your fix into the attached patch.

BTW, why didn't planner choose a materialized plan for the inner loop?
FDW scans are typically slower than heap scans or TupleTableslot scans,
it seems reasonable for me to add a Materialize node at the top of the
inner Foreign Scan, especially when we don't use indexes for the scan
keys or join keys.

--
Itagaki Takahiro

Attachment Content-Type Size
copy_export-20110114.patch application/octet-stream 45.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-01-14 04:14:10 Re: limiting hint bit I/O
Previous Message Tom Lane 2011-01-14 03:43:39 Re: limiting hint bit I/O