pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hermann Matthes <hermann.matthes@web.de>
To: pgsql-performance@postgresql.org
Subject: Paged Query
Date: Wed, 04 Jul 2012 14:25:28 +0200
Message-ID: <4FF43638.5080301@web.de> (raw)

I want to implement a "paged Query" feature, where the user can enter in 
a dialog, how much rows he want to see. After displaying the first page 
of rows, he can can push a button to display the next/previous page.
On database level I could user "limit" to implement this feature. My 
problem now is, that the user is not permitted to view all rows. For 
every row a permission check is performed and if permission is granted, 
the row is added to the list of rows sent to the client.
If for example the user has entered a page size of 50 and I use "limit 
50" to only fetch 50 records, what should I do if he is only permitted 
to see 20 of these 50 records? There may be more records he can view.
But if I don't use "limit", what happens if the query would return 
5,000,000 rows? Would my result set contain 5,000,000 rows or would the 
performance of the database go down?

Thanks in advance
Hermann



view thread (19+ messages)  latest in thread

Message-ID: <4FF43638.5080301@web.de>
Permalink:  ../4FF43638.5080301@web.de/
Also on:    postgresql.org/message-id/4FF43638.5080301@web.de

 · 

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: hermann.matthes@web.de
  Subject: Re: Paged Query
  In-Reply-To: <4FF43638.5080301@web.de>

* 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