pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vanitha Jaya <e.vanitha@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Internal Operations on LIMIT & OFFSET clause
Date: Tue, 29 Aug 2006 12:51:27 +0530
Message-ID: <b4a87cef0608290021g26965584ld05c3d11b217c2ec@mail.gmail.com> (raw)

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)

view thread (2+ messages)  latest in thread

Message-ID: <b4a87cef0608290021g26965584ld05c3d11b217c2ec@mail.gmail.com>
Permalink:  ../b4a87cef0608290021g26965584ld05c3d11b217c2ec@mail.gmail.com/
Also on:    postgresql.org/message-id/b4a87cef0608290021g26965584ld05c3d11b217c2ec@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: e.vanitha@gmail.com
  Subject: Re: Internal Operations on LIMIT & OFFSET clause
  In-Reply-To: <b4a87cef0608290021g26965584ld05c3d11b217c2ec@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox