Fetch a single record - Mailing list pgsql-sql

From david_shadovitz@xontech.com (David Shadovitz)
Subject Fetch a single record
Date
Msg-id 8b37e2e5.0312051351.4045b4e@posting.google.com
Whole thread Raw
Responses Re: Fetch a single record  (Peter Eisentraut <peter_e@gmx.net>)
Re: Fetch a single record  (Paul Thomas <paul@tmsl.demon.co.uk>)
Re: Fetch a single record  (greg@turnstep.com)
List pgsql-sql
I'm looking for the fastest way to fetch a single record from a table.I don't care what record it is.

Here are two techniques I've explored:

1. Use LIMIT
SELECT * FROM myTable LIMIT 1

2. Get a valid OID and then get the record.
SELECT MIN(oid) AS anOID FROM myTable
SELECT * FROM myTable WHERE oid = anOID

The 1st technique is slow.  (I think PostgreSQL fetches all records
and then returns just one.)  The 2nd is faster, but not fast enough.

Any other ideas?  Please reply to me personally (david@shadovitz.com)
as well as to the list.

Thanks.
-David


pgsql-sql by date:

Previous
From: "Ganesan Kanavathy"
Date:
Subject: Field Size
Next
From: "Marc A. Leith"
Date:
Subject: Re: [ADMIN] Field Size