pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Conway <neilc@samurai.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: Karl O. Pinc <kop@meme.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Using LIMIT 1 in plpgsql PERFORM statements
Date: Mon, 24 Oct 2005 00:40:10 -0400
Message-ID: <1130128810.8506.25.camel@localhost.localdomain> (raw)
In-Reply-To: <200510232136.35790.josh@agliodbs.com>
References: <1129957521l.27845l.2l@mofo>
	<200510231402.35612.josh@agliodbs.com>
	<1130114418l.8670l.2l@mofo>
	<200510232136.35790.josh@agliodbs.com>

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





view thread (6+ messages)

Message-ID: <1130128810.8506.25.camel@localhost.localdomain>
Permalink:  ../1130128810.8506.25.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1130128810.8506.25.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: neilc@samurai.com, josh@agliodbs.com, kop@meme.com
  Subject: Re: Using LIMIT 1 in plpgsql PERFORM statements
  In-Reply-To: <1130128810.8506.25.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox