Walter D. Funk wrote:

>Hi everybody,
>
>is there a way to calculate the number of rows retrieved by a mysql query,
>without actually performing it?
>
>I want to make a paginated result like in most search engines, and for that
>I need to display the number of pages
>the result would have, but I do not want to actually retrieve all the rows
>to be able to count them, because this is
>a loss of performance, in particular if the result set retrieves 100000 rows
>and 100 people make a search; this would
>end in 10000 x 100 rows just to say how many pages the result will have, I
>think there must be a better way to do it, isn't it?
>  
>

No way! Should the database guess on it? ;-)

SELECT count(*) FROM ... WHERE ...;

Just like your query looks like is the only way.

>  
>

-- 
Ralf Narozny
SPLENDID Internet GmbH & Co KG
Skandinaviendamm 212, 24109 Kiel, Germany
fon: +49 431 660 97 0, fax: +49 431 660 97 20
mailto:[EMAIL PROTECTED], http://www.splendid.de




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to