Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can

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

 



Joshua D. Drake wrote:
On Mon, 2006-12-11 at 14:33 +1100, Chris wrote:
Marcos Borges wrote:
07/12/2006 04:31
*SQL_CALC_FOUND_ROWS in POSTGRESQL*

In mysqln i m using the command SQL_CALC_FOUND_ROWS in follow sintax.
SELECT SQL_CALC_FOUND_ROWS name, email, tel FROM mytable WHERE name <> '' LIMIT 0, 10
to have the recorset data.
and
SELECT FOUND_ROWS();
to have the total of registers found.

I dont want to use the command count(*), because the performance will fall down, depending of the quantyt of tables and "joins".

The Data base postgresql have something similar ???
Nope, you're out of luck sorry. That's a mysql-ism and I doubt postgres will ever include something similar.

Your language will have a similar binding. Something like pg_numrows.

I guess they are similar but also not really :)

The SQL_CALC_FOUND_ROWS directive in mysql will run the same query but without the limit.

It's the same as doing a select count(*) type query using the same clauses, but all in one query instead of two.

It doesn't return any extra rows on top of the limit query so it's better than using pg_numrows which runs the whole query and returns it to php (in this example).


Their docs explain it:

http://dev.mysql.com/doc/refman/4.1/en/information-functions.html

See "FOUND_ROWS()"

--
Postgresql & php tutorials
http://www.designmagick.com/


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux