From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Function performance degrades after repeated execution
Date: Sat, 16 Nov 2019 09:45:28 -0600
Message-ID: <7f0d6a8b-bf7e-a2bb-a248-62239c67fee8@gmail.com> (raw)
In-Reply-To: <C4ABE222F455C04FB64CC3B7147428890117A2B5D8@ORD2MBX02E.mex05.mlsrvr.com>
References: <C4ABE222F455C04FB64CC3B7147428890117A2B5D8@ORD2MBX02E.mex05.mlsrvr.com>
On 11/16/19 8:22 AM, Dave Roberge wrote:
> Hi,
>
> We've been troubleshooting a slow running function in our postgres database. I've been able to boil it down to the simplest function possible. It looks like this:
>
> FOR rec IN select 1 as matchval FROM table1 t1, table2 t2
> join table3 t3 on t3.col = t2.col
> WHERE t1.col = id
> LOOP
> IF rec.matchval > 0 THEN
> co := co + 1;
> END IF;
> if co % 100 = 0 then
> raise notice 'match value %', co;
> end if;
> END LOOP;
Where are you joining table1 to either table2 or table3?
--
Angular momentum makes the world go 'round.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: Function performance degrades after repeated execution
In-Reply-To: <7f0d6a8b-bf7e-a2bb-a248-62239c67fee8@gmail.com>
References: <C4ABE222F455C04FB64CC3B7147428890117A2B5D8@ORD2MBX02E.mex05.mlsrvr.com> <7f0d6a8b-bf7e-a2bb-a248-62239c67fee8@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox