From: Warren Young Date: September 14 2010 6:39pm Subject: Re: Get the number of rows with a "used" query. List-Archive: http://lists.mysql.com/plusplus/9047 Message-Id: MIME-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable On Sep 14, 2010, at 3:25 AM, m p wrote: > So : is it possible to get the numbers of rows returned by a query = using the > mysqlpp::UseQueryResult object ? > (Without obviously looking through all tuples) Not without making the database server do a second table scan ahead of = the "use" query. The least inefficient way to ask it to do that is to use the COUNT = function: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html e.g. SELECT COUNT(*) FROM my_table WHERE some_col=3Dvalue; That will tell you how many rows in my_table have the given some_col = value. Beware that if the table is changed between the COUNT query and = "real" query, the count can be off. It may be possible to guarantee an = accurate count by wrapping both queries in a transaction, but I couldn't = say for sure. > And is it maybe possible to seek back in the query results ? No. MySQL limitation.=