View Single Post

   
  #6 (permalink)  
Old 04-18-2008, 01:35 PM
Neil Conway
 
Posts: n/a
Default Re: Using LIMIT 1 in plpgsql PERFORM statements

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



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote