Frank Wiles wrote:
> On Fri, 31 Mar 2006 14:47:37 +0200
> Issac Goldstand <[EMAIL PROTECTED]> wrote:
> 
>> Granted, I use a few MySQL features for this; I'm not sure if LIMIT
>> exists in postgresql, and I'm fairly sure that the SQL_CALC_FOUND_ROWS
>> directive (which will return the total rows in a select statement
>> regardless of the LIMIT directives) doesn't...
> 
>   PostgreSQL has LIMIT... it's a SQL standard.  And I don't really see
>   why you would need SQL_CALC_FOUND_ROWS unless you where going to
>   show the total number of pages.  For simple Next/Previous paging
>   you just keep going until you fall off the end. 
> 
>   If you need to get a count you can just do a count() on a particular
>   column without the LIMIT and get a total. 
> 

Not the total number of pages per se, but numbered result pages.  And if
there are, say, left joins (or other operations which prevent being able
to do count() on a nice clean index) involved, it's usually cheaper to
do CALC_FOUND_ROWS on the one operation, rather than having to run the
complex filtering operation again in a second SQL statement (for COUNT())

  Issac

Reply via email to