Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can - Mailing list pgsql-performance

From Andreas Kostyrka
Subject Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Date
Msg-id 20061211064214.GV2050@andi-lap.la.revver.com
Whole thread Raw
In response to Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can  (Chris <dmagick@gmail.com>)
List pgsql-performance
* Chris <dmagick@gmail.com> [061211 07:01]:
> select SQL_CALC_FOUND_ROWS userid, username, password from users limit 10;
>
> will do:
>
> select userid, username, password from users limit 10;
>
> and calculate this:
>
> select userid, username, password from users;
>
> and tell you how many rows that will return (so you can call 'found_rows()').
>
>
> the second one does do a lot more because it has to send the results across to the client program - whether the
clientuses that info or not doesn't matter. 
Not really. Sending the data to the client is usually (if you are not
connected via some small-bandwidth connection) a trivial cost compared
to calculating the number of rows.

(Our tables involve 100Ms of rows, while the net connectivity is a
private internal Gigabit net, returning the data seems never to be an
issue. Reading it from the disc, selecting the rows are issues. Not
sending the data.)

Actually, if you think that sending the data is an issue, PG offers
the more generic concept of cursors.

Andreas

pgsql-performance by date:

Previous
From: Chris
Date:
Subject: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Next
From: "Ravindran G - TLS, Chennai."
Date:
Subject: Postgresql - Threshold value.