Re: Saving loading time at counting rows

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

 



On Sat, Jul 12, 2008 at 8:26 PM, Joep Roebroek <j.roebroek@xxxxxxxxx> wrote:
> I had this question, which I didn't really know where to ask, so I
> thought to begin at this mailing list.
>
> Very basicly said, I count the rows of a table which had approx 50000
> or more rows.
>
> The problem is, there is a notable difference in loading time with
> other pages. Is there a technique to estimate the number of rows
> instead of exactly couting them? So that it saves loading time.
>
> For example, when you search with google, you get an estimate of the
> number of results, how do they do this?
>
> Maybe this is not a question for the PHP Mailing list, but if not
> where is a better place to ask this?
>
> regards,
>
> Joep
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

In general get in the mindset of making your web app have fast reads
and allow slower writes.  So instead of generating a very expensive
count query on each request (or read), make sure that you have some
pre-generated count elsewhere.  You can even tie this generate count
routine to any add/edit/delete's to make sure that it is up to date or
just cron it for some interval.

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