Re: [SQL] Fetch a single record

2003-12-09 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I'm looking for the fastest way to fetch a single record from a table. > I don't care what record it is. That's a strange request. If you really don't care what comes back, you don't even need to query a table: SELECT 1; If you perhaps want

Re: [SQL] Fetch a single record

2003-12-09 Thread Paul Thomas
On 05/12/2003 21:51 David Shadovitz wrote: I'm looking for the fastest way to fetch a single record from a table. I don't care what record it is. [snip] Have you also tried SELECT * from mytable limit 1 If you genuinely don't care what the record is (I assume you're justing testing that table i

Re: [SQL] Fetch a single record

2003-12-09 Thread Peter Eisentraut
David Shadovitz wrote: > 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 FR

[SQL] Fetch a single record

2003-12-09 Thread David Shadovitz
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