X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 84AD2D1B4B0 for ; Wed, 10 Dec 2003 00:46:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51534-09 for ; Tue, 9 Dec 2003 20:45:40 -0400 (AST) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 63266D1B461 for ; Tue, 9 Dec 2003 20:45:37 -0400 (AST) Received: (qmail 29368 invoked from network); 10 Dec 2003 00:45:40 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 10 Dec 2003 00:45:40 -0000 From: greg@turnstep.com To: pgsql-sql@postgresql.org Cc: david_shadovitz@xontech.com Cc: david_shadovitz@xontech.com Subject: Re: Fetch a single record X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <8b37e2e5.0312051351.4045b4e@posting.google.com> Date: Wed, 10 Dec 2003 00:45:40 -0000 X-Mailer: JoyMail 1.38 Message-ID: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/77 X-Sequence-Number: 16243 -----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 the column names, query the system tables. Otherwise the LIMIT 1 should be very fast, especially if you have no ordering. Avoid the "SELECT *" if you don't need all the columns for a little more speed. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200312091943 -----BEGIN PGP SIGNATURE----- iD8DBQE/1mynvJuQZxSWSsgRAk0HAKDKTHglcodYw2G9j5Il60e96Vv/xwCfcZ6p ffIBwsqFtqW0UABYttqzT3U= =JV2a -----END PGP SIGNATURE-----