X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 124D09FB1F9 for ; Tue, 29 Aug 2006 04:21:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 38911-02 for ; Tue, 29 Aug 2006 04:21:29 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.194]) by postgresql.org (Postfix) with ESMTP id 3830C9FB1F8 for ; Tue, 29 Aug 2006 04:21:29 -0300 (ADT) Received: by nz-out-0102.google.com with SMTP id 14so1396701nzn for ; Tue, 29 Aug 2006 00:21:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=DSAOatuYX86RXWNlyiJqtuJEwH/waeDfgoakrhN4yVnmsKyI0X/MD0YnWpb70PhCvrf8XyYb7re+d4hWMIPpOe9O4EIj+RqlWLST+7V28sDNhyCwo5gnqVgQ7TF0HTro6YOMCjUF+faWlf2vMjanDnqOOLcLhBCPQ3FKx6MLNX4= Received: by 10.64.249.18 with SMTP id w18mr8041746qbh; Tue, 29 Aug 2006 00:21:28 -0700 (PDT) Received: by 10.64.179.13 with HTTP; Tue, 29 Aug 2006 00:21:27 -0700 (PDT) Message-ID: Date: Tue, 29 Aug 2006 12:51:27 +0530 From: "Vanitha Jaya" To: pgsql-performance@postgresql.org Subject: Internal Operations on LIMIT & OFFSET clause MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2910_23421601.1156836087809" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.574 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/451 X-Sequence-Number: 20636 ------=_Part_2910_23421601.1156836087809 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Friends, I have one doubt in LIMIT & OFFSET clause operation. I have a table "test_limit", and it contain, SELECT * from test_limit; s_no | name ------+------------- 1 | anbarasu 8 | egambaram 12 | jyothi 6 | mahalakshmi 4 | maheswari 2 | manju 5 | ramkumar 7 | sangeetha 11 | sasikala 10 | thekkamalai 9 | vivek 13 | ganeshwari 3 | anandhi (13 rows) Here, I applied LIMIT clause as bellow. SELECT * from test_limit LIMIT 5; s_no | name ------+------------- 1 | anbarasu 8 | egambaram 12 | jyothi 6 | mahalakshmi 4 | maheswari (5 rows) In this above query was processed only five records OR all the 13 record was got and then only 5 record printed. this is what my doubt. I tried where clause in above query as bellow. SELECT * from test_limit where s_no IN (1,2,3,4,5,6,7,8,9) LIMIT 5; s_no | name ------+------------- 1 | anbarasu 8 | egambaram 6 | mahalakshmi 4 | maheswari 2 | manju (5 rows) In this case It should process up to records fulfill the requirement. i.e atleast it should process 6 records. My question is it is processed only 6 records (fulfill the requirement) or all (13) the records. I also tried ORDER BY clause as bellow. SELECT * from test_limit ORDER BY s_no LIMIT 5; s_no | name ------+----------- 1 | anbarasu 2 | manju 3 | anandhi 4 | maheswari 5 | ramkumar (5 rows)