Re: Using LIMIT 1 in plpgsql PERFORM statements - Mailing list pgsql-performance

From Neil Conway
Subject Re: Using LIMIT 1 in plpgsql PERFORM statements
Date
Msg-id 1130128810.8506.25.camel@localhost.localdomain
Whole thread Raw
In response to Re: Using LIMIT 1 in plpgsql PERFORM statements  (Josh Berkus <josh@agliodbs.com>)
List 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



pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Using LIMIT 1 in plpgsql PERFORM statements
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: prepared transactions that persist across sessions?