Re: Using LIMIT 1 in plpgsql PERFORM statements

From: Neil Conway <neilc(at)samurai(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: "Karl O(dot) Pinc" <kop(at)meme(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Using LIMIT 1 in plpgsql PERFORM statements
Date: 2005-10-24 04:40:10
Message-ID: 1130128810.8506.25.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, 2005-23-10 at 21:36 -0700, Josh Berkus wrote:
> SELECT id INTO v_check
> FROM some_table ORDER BY id LIMIT 1;
>
> IF id > 0 THEN ....
>
> ... that says pretty clearly to code maintainers that I'm only interested in
> finding out whether there's any rows in the table, while making sure I use
> the index on ID.

Why would you want to use the index on ID?

-Neil

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-10-24 05:03:03 Re: prepared transactions that persist across sessions?
Previous Message Josh Berkus 2005-10-24 04:36:35 Re: Using LIMIT 1 in plpgsql PERFORM statements