Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
От | Andreas Kostyrka |
---|---|
Тема | Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can |
Дата | |
Msg-id | 20061211064214.GV2050@andi-lap.la.revver.com обсуждение исходный текст |
Ответ на | Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can (Chris <dmagick@gmail.com>) |
Список | 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 по дате отправления: