Re: Excessive memory used for INSERT

From: Alessandro Ipe <Alessandro(dot)Ipe(at)meteo(dot)be>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org, Torsten Zuehlsdorff <mailinglists(at)toco-domains(dot)de>
Subject: Re: Excessive memory used for INSERT
Date: 2014-12-23 11:56:03
Message-ID: 6006964.iXUoRzG9pV@snow.oma.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I guess the memory consumption is depending on the size of my database, so
only giving a reduced version of it won't allow to hit the issue.

The pg_dumpall file of my database can be found at the address
https://gerb.oma.be/owncloud/public.php?service=files&t=5e0e9e1bb06dce1d12c95662a9ee1c03

The queries causing the issue are given in files
- tmp.OqOavPYbHa (with the new upsert_func function)
- tmp.f60wlgEDWB (with WITH .. AS statement)

I hope it will help. Thanks.

Regards,

A.

On Thursday 18 December 2014 12:05:45 Tom Lane wrote:
> Alessandro Ipe <Alessandro(dot)Ipe(at)meteo(dot)be> writes:
> > Hi,
> > I tried also with an upsert function
> > CREATE FUNCTION upsert_func(sql_insert text, sql_update text) RETURNS void
> >
> > LANGUAGE plpgsql
> > AS $$
> >
> > BEGIN
> > EXECUTE sql_update;
> > IF FOUND THEN
> >
> > RETURN;
> >
> > END IF;
> > BEGIN
> >
> > EXECUTE sql_insert;
> > EXCEPTION WHEN OTHERS THEN
> > EXECUTE sql_update;
> > END;
> >
> > RETURN;
> >
> > END;
> > $$;
> > with the same result on the memory used...
>
> If you want to provide a self-contained test case, possibly we could look
> into it, but these fragmentary bits of what you're doing don't really
> constitute an investigatable problem statement.
>
> I will note that EXCEPTION blocks aren't terribly cheap, so if you're
> reaching the "EXECUTE sql_insert" a lot of times that might have something
> to do with it.
>
> regards, tom lane

Attachment Content-Type Size
tmp.OqOavPYbHa text/plain 6.9 KB
tmp.f60wlgEDWB text/plain 7.9 KB

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2014-12-23 20:27:41 Re: Excessive memory used for INSERT
Previous Message Heikki Linnakangas 2014-12-23 10:28:42 Re: PATCH: adaptive ndistinct estimator v3 (WAS: Re: [PERFORM] Yet another abort-early plan disaster on 9.3)