Re: paging results in large resultsets: mysql vs postgresql?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 11:11 AM -0500 6/15/06, D. Dante Lorenso wrote:
>I can't seem to find the equivalent of it in PostgreSQL!  The only options I see are:
>
>  1.
>
>     TWO queries.  The first query will perform a SELECT COUNT(*) ...; and the second query performs the actualy SELECT ... LIMIT x OFFSET y;
>
>-snip-
>
>I hate having to write 2 queries to get one set of data ... especially when those queries start getting complex.

I do exactly number 1 in http://ancientstones.com/catalog.php

Keep in mind that the first query will tell you how many record are in that specific sort and then the second will present just those items. You have to work out the pageNumber, maxPageNumber, and numberOfPages and then it's simple.

If you're concerned about the complexity of the query, then it makes sense to break it down to simpler steps.

You should see the back-end of my site where if you are give a specific item, then where do you place it in a page given the user's search criteria. It made for an interesting exorcise.

tedd

-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux