Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 13530133655C for ; Thu, 16 Dec 2010 15:18:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 78628-06-4 for ; Thu, 16 Dec 2010 19:18:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yx0-f174.google.com (mail-yx0-f174.google.com [209.85.213.174]) by mail.postgresql.org (Postfix) with ESMTP id C0F121337BC3 for ; Thu, 16 Dec 2010 15:18:49 -0400 (AST) Received: by yxt3 with SMTP id 3so1849978yxt.19 for ; Thu, 16 Dec 2010 11:18:49 -0800 (PST) Received: by 10.236.109.11 with SMTP id r11mr2245231yhg.95.1292527129138; Thu, 16 Dec 2010 11:18:49 -0800 (PST) Received: from ANIBALVAIO ([190.128.222.90]) by mx.google.com with ESMTPS id j64sm238193yha.35.2010.12.16.11.18.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 16 Dec 2010 11:18:48 -0800 (PST) From: "Anibal David Acosta" To: Subject: using limit Date: Thu, 16 Dec 2010 16:18:50 -0300 Message-ID: <001f01cb9d56$13d69790$3b83c6b0$@devshock.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0020_01CB9D3C.EE8BD090" X-Mailer: Microsoft Outlook 14.0 Content-Language: es-py Thread-Index: AcudVWq9DKLKRaRwRb+9F4g65/D4MQ== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201012/110 X-Sequence-Number: 36339 This is a multipart message in MIME format. ------=_NextPart_000_0020_01CB9D3C.EE8BD090 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi I really like to do efficient SQL queries so, my question is if I am expecting no more than one row from a select, using the LIMIT 1 could improve the performance? If I use my logic, the LIMIT 1 instruction tell to postgres that stop searching when found 1 record, but maybe it is unnecessary Thanks Anibal ------=_NextPart_000_0020_01CB9D3C.EE8BD090 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi

I really like to do efficient SQL queries so, my question = is if I am expecting no more than one row from a select, using  the = LIMIT 1 could improve the performance?

 

If I use my logic, the LIMIT 1 = instruction tell to postgres that stop searching when found 1 record, = but maybe it is unnecessary

 

 

Thanks

 

Anibal

------=_NextPart_000_0020_01CB9D3C.EE8BD090--