Re: Paginating searchs = performance problem

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

 



On Fri, 20 Oct 2006 17:04:35 +0200, Fourat Zouari wrote:

> I have PHP/PostgreSQL application were i got a search page with some items
> to search, am building the search query on server side.
> 
> I need to display a paginated search and for this i need to get the total
> count of lines matching the search before OFFSET/LIMITing my page, am i
> obliged to repeat the query twice ??? first to get the total count, second
> to get my page.
> 
> it's very heavy
> 
> Any one's suggesting better doing ?

As far as I know, this is the only way. The first query, you don't need to
sort your data though, and you might be able to drop a join, depending on
whether or not you use the joined table in your WHERE clause.

But I think due to caching the database will not take a long time for the
second query, since it just recently had (almost) the same query - YMMV.

Ivo

-- 
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