Re: Using LIMIT 1 in plpgsql PERFORM statements

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Using LIMIT 1 in plpgsql PERFORM statements
Date: 2005-10-24 00:25:09
Message-ID: 1130113509l.8670l.1l@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On 10/23/2005 04:02:35 PM, Josh Berkus wrote:
> Karl,
>
> > PERFORM 1 FROM foo;
> > IF FOUND THEN ...
> >
> > is any slower than:
> >
> > PERFORM 1 FROM foo LIMIT 1;
> > IF FOUND THEN ...
>
> I'm wondering in what context it makes sense to call PERFORM on a
> constant.

If you want to find out if the table has any rows.
I'm really interested in what happens when
there's a WHERE qualification. I want to find
out if there's any of some particular sort of row.
But I figured it wasn't worth putting that into
the example because I didn't have anything
specific to put in the WHERE clause. I suppose
I should have put it in anyway and followed with ....

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Karl O. Pinc 2005-10-24 00:40:18 Re: Using LIMIT 1 in plpgsql PERFORM statements
Previous Message Steinar H. Gunderson 2005-10-24 00:08:24 Re: Problem analyzing explain analyze output