Questions about LIMIT/OFFSET

From: Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Questions about LIMIT/OFFSET
Date: 2007-10-19 21:03:04
Message-ID: 20071019160304.2c09c21c@prokofiev.trutwins.homeip.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm going to be using a smarty plugin to paginate some result sets
for display in smarty templates. I was reading that using LIMIT/OFFSET
generates multiple query plans so I'm curious if it would be better
to do a:

SELECT * FROM table WHERE foo="bar" ORDER BY abc LIMIT x OFFSET y;

or just:

SELECT * FROM table WHERE foo="bar" ORDER BY abc;

and create my result set array for my templates using application ode
- increasing the likelihood of pulling the above query from the cache?
I'm sure the answer is "it depends" but curious what others do with
this?

Thanks,

Josh

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-10-19 21:06:17 Re: ERROR: Could not access status of transaction ####
Previous Message Dimitri Fontaine 2007-10-19 20:59:54 Re: Abbreviation list