Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group